Search code examples
c++linuxqtqt5qmake

Properly using QMAKE_POST_LINK in Qt project file


When adding commands to QMAKE_POST_LINK using += operator should I need to add a semicolon?

For example,

QMAKE_POST_LINK += mv somefile1.dat /some_location1; # semicolon
QMAKE_POST_LINK += mv somefile2.dat /some_location2
...

Without the semicolon Qt doesn't separate the commands.

Is this proper functionality?


Solution

  • You should add $$escape_expand(\n\t) at the end of the each command.

    Some examples (just took from my real app):

    QMAKE_POST_LINK += "cp -f $$OUT_PWD/$$DESTDIR/crashreporter.app/Contents/MacOS/crashreporter $$MACX_APP_MACOS_DIR" $$escape_expand(\n\t)
    QMAKE_POST_LINK += "cp -R" $$VMSCLSHARED_DYLIBS $$MACX_APP_FW_DIR/ $$escape_expand(\n\t)
    

    Here is one yet example: https://gist.github.com/Wohlstand/3d9455c4baddc057de60e511f7280b87