From 45caf287604be8d7e0c39eb3c998e5fd6f62006b Mon Sep 17 00:00:00 2001 From: Marius P Date: Mon, 29 Aug 2022 13:06:13 +0300 Subject: [PATCH] project file allow installation in another dir than "/usr" E.g. this way I can build and install in "~/.local", or "/usr/local". --- app/app.pro | 18 ++++++++++++------ cool-retro-term.pro | 12 +++++++++++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/app.pro b/app/app.pro index 1e42dcca..502dfc08 100644 --- a/app/app.pro +++ b/app/app.pro @@ -16,23 +16,29 @@ macx:ICON = icons/crt.icns RESOURCES += qml/resources.qrc ######################################### -## INTALLS +## INSTALLS ######################################### -target.path += /usr/bin/ +PREFIX = $$(PREFIX) # Pass the make install PREFIX via environment variable. E.g. "PREFIX=/path/to/my/dir qmake". +isEmpty(PREFIX) { + message(No prefix given. Using /usr.) + PREFIX=/usr +} + +target.path = $$PREFIX/bin INSTALLS += target # Install icons unix { icon32.files = icons/32x32/cool-retro-term.png - icon32.path = /usr/share/icons/hicolor/32x32/apps + icon32.path = $$PREFIX/share/icons/hicolor/32x32/apps icon64.files = icons/64x64/cool-retro-term.png - icon64.path = /usr/share/icons/hicolor/64x64/apps + icon64.path = $$PREFIX/share/icons/hicolor/64x64/apps icon128.files = icons/128x128/cool-retro-term.png - icon128.path = /usr/share/icons/hicolor/128x128/apps + icon128.path = $$PREFIX/share/icons/hicolor/128x128/apps icon256.files = icons/256x256/cool-retro-term.png - icon256.path = /usr/share/icons/hicolor/256x256/apps + icon256.path = $$PREFIX/share/icons/hicolor/256x256/apps INSTALLS += icon32 icon64 icon128 icon256 } diff --git a/cool-retro-term.pro b/cool-retro-term.pro index 851f0b4a..b4809e2f 100644 --- a/cool-retro-term.pro +++ b/cool-retro-term.pro @@ -5,7 +5,17 @@ CONFIG += ordered SUBDIRS += qmltermwidget SUBDIRS += app +######################################### +## INSTALLS +######################################### + +PREFIX = $$(PREFIX) # Pass the make install PREFIX via environment variable. E.g. "PREFIX=/path/to/my/dir qmake". +isEmpty(PREFIX) { + message(No prefix given. Using /usr.) + PREFIX=/usr +} + desktop.files += cool-retro-term.desktop -desktop.path += /usr/share/applications +desktop.path += $$PREFIX/share/applications INSTALLS += desktop