qmake generates the following rule for installing a target:
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(TARGET)"
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/$(TARGET)"
To copy to clipboard, switch view to plain text mode
I cannot set INSTALL_ROOT with something like this in a *.pro file
isEmpty(INSTALL_ROOT) {
INSTALL_ROOT=/usr
}
isEmpty(INSTALL_ROOT) {
INSTALL_ROOT=/usr
}
To copy to clipboard, switch view to plain text mode
because INSTALL_ROOT is somehow local to generated Makefiles. According to what I've found out so far INSTALL_ROOT is empty by default. It could be used like
INSTALL_ROOT=$HOME make install
INSTALL_ROOT=$HOME make install
To copy to clipboard, switch view to plain text mode
when invoking make, which is fine. However I want to be able to specify default installation root, say /usr. I can do it introducing a new variable PREFIX as suggested here. Then generated rule will look like (if PREFIX was set to /usr)
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/usr/$(TARGET)"
-$(INSTALL_PROGRAM) "$(TARGET)" "$(INSTALL_ROOT)/usr/$(TARGET)"
To copy to clipboard, switch view to plain text mode
however, if somebody calls
INSTALL_ROOT=$HOME make install
INSTALL_ROOT=$HOME make install
To copy to clipboard, switch view to plain text mode
then target will be installed to
/home/<user_name>/usr/$(TARGET)
/home/<user_name>/usr/$(TARGET)
To copy to clipboard, switch view to plain text mode
which is not that one would expect.
So setting INSTALL_ROOT to some default value will produce consistent behavior, which is superior to adding PREFIX, but how to set INSTALL_ROOT in a *.pro file?
Bookmarks