Qt World Summit: Register Today!

qmake: copy dir or file on each build

  • I have an extra library ("pri" - project) with dir "android/src/mypackage" and want copy that dir at each build, following works only on clean build or complete rebuild:

    QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_path($$PWD/android/src/mypackage) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/src/mypackage) $$escape_expand(\n\t)

    Qt 5.15.2, QtCreator 4.14.2 on Windows

  • @morte

    Which version of qmake are you using?

    In principle it shall work. I am using a similar command in my qmake files. However, I am not using the undocumented QMAKE_COPY_DIR but an xcopy with switches on windows.

    AFAIK the command will work only after a successful link as the QMAKE_POST_LINK already suggests. A simple restart of qmake later is not working.

    Probably you may get some idea of the logic created in makefile.

  • It looks like QMAKE_POST_LINK is not suitable for this, as its no executed on each build is there another solution like "INSTALLS" qmake variable?

Log in to reply