Get qmake to execute shell script after build finished on Mac

倖福魔咒の 提交于 2019-12-04 23:46:23

问题


After my release build is finished I would like to run a script.

I found this question How to execute shell command after compile finished from .pro in QT? but the answer doesn't work for me. I tried adding various modifications of this to my .pro file:

CONFIG(release, debug|release) {
    mytarget.target = ./MyScript.sh
    mytarget.commands = touch $$mytarget.target

    QMAKE_EXTRA_TARGETS +=mytarget
    QMAKE_POST_LINK += mytarget
}

But this always results with ":-1: error: mytarget: No such file or directory". Path is correct and 'MyScript.sh' works fine from command line.

Since this works for other people I guess I’m doing something wrong. I use Qt 4.7.2 on Mac.


回答1:


Path is relative to build directory. If your script is not in your build directory,you have to change path. Try using ../MyScript.sh

Why are you using target? If your only intent is to execute MyScript.sh after the build, you need only

QMAKE_POST_LINK += ./MyScript.sh


来源:https://stackoverflow.com/questions/6300148/get-qmake-to-execute-shell-script-after-build-finished-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!