问题
This is for setting up the application bundle of a MacOSX app. I have a script which copies a few files and does some other things. So I want to execute the script after the build (i.e. after the linking step). I want it to be executed just every time because it is not possible to specify its dependencies.
I know there is QMAKE_POST_LINK
(e.g. described here or here) but it runs only when the target does not exists, i.e. when linking needs to be done. However, I want the script to run every time, also when the target already exists.
There is also QMAKE_EXTRA_TARGETS
and POST_TARGETDEPS
(e.g. described here) but that forces a relink all the time but I actually only want the script to rerun and it runs the script before the linking. (Currently, that's what I'm using using anyway, because I don't see a better way. Here is my QMake source.)
回答1:
There is related questions there and there. I quote my answer for first of them:
Another way to make things in given order is to use empty "super" target:
super.depends = target_pre first target_post QMAKE_EXTRA_TARGETS += super
Where
first
- is default qmake target, andtarget_pre
andtarget_post
some custom targets. Nowmake super
just do the thing.
EDIT: looks like in last versions of Qt build of dependencies is running in paralell so this solution wouldn't work.
来源:https://stackoverflow.com/questions/21528022/qmake-execute-script-after-build