Copy a file to build directory after compiling project with Qt

后端 未结 6 1793
孤街浪徒
孤街浪徒 2020-12-13 06:36

I have seen several suggestions, but nothing really worked for me as I want. I just need to copy a file to the desired destination directory.

Say, for example from t

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 07:23

    This in a modified variant of PKSWE's method.

    dummyTarget.commands = @echo After building copy..
    QMAKE_EXTRA_TARGETS += dummyTarget
    PRE_TARGETDEPS += dummyTarget
    
    toolsCopy.commands = $(COPY_DIR) $$shell_path($$PWD/copyDir/*) $$shell_path($$DESTDIR)
    dummyTarget.depends += toolsCopy
    QMAKE_EXTRA_TARGETS += toolsCopy
    
    toolsCopyLib.commands = $(COPY_FILE) $$shell_path($$PWD/setting.ini) $$shell_path($${DESTDIR})
    dummyTarget.depends += toolsCopyLib
    QMAKE_EXTRA_TARGETS += toolsCopyLib
    

    But, I have an other question, how to copy if changed? Since it takes too much time when it doesn't need to copy.

提交回复
热议问题