Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get qmake to execute shell script after build finished on Mac

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.

like image 532
Galadrius Krunthar Avatar asked Jun 09 '11 22:06

Galadrius Krunthar


1 Answers

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
like image 172
Alessandro Pezzato Avatar answered Sep 28 '22 19:09

Alessandro Pezzato