inapp qmake install

make install

The easy way to install your Qt program with qmake is to add this to your .pro file:

target.path = /usr/local/myprogram
INSTALLS += target

qmake will find itself what is the binary to copy to the target path. According to the documentation [1], only target and dlltarget are supported. Any other install set name is available [2].

To install a file from the build folder, $$OUT_PWD [3] will be replaced by the corresponding path:

# Install settings
binary.files = $$OUT_PWD/inapp2/inapp2
binary.path = /opt/ina/pp/bin/

plugin.files = $$OUT_PWD/inapp2/plugin/*.so
plugin.path = /opt/ina/pp/bin/plugin/

script.files = etc/*
script.path = /opt/ina/pp/etc/

INSTALLS += binary plugin script


A little problem: all files with execution rights are automatically stripped from debug symbols using strip. Since the bash scripts have execution rights as well, the Makefile tries to strip them, and predictably fails [4].

Far from perfect solution: have the script files without exec rights, and add them with an additional install step:

post_script.path = /opt/ina/pp/etc/
unix:post_script.extra = chmod 755 /opt/ina/pp/etc/*

INSTALLS += binary plugin script post_script


[1]Qt docs, Advanced Usage,
[2]Stackoverflow, "How do I specify input the QMake INSTALLS variable?",
[3]Stackoverflow, "Copy a file to build directory after compiling project with Qt",
[4]MythTV Dev Mailing list, " How do you stop qmake from trying to strip all installed files?",