PDA

View Full Version : Post-Build actions using qmake



bhs-ittech
24th August 2007, 09:27
Is it possible to define some actions in the project file
which is executed after the build is done?

fullmetalcoder
24th August 2007, 10:03
This is documented (http://doc.trolltech.com/4.3/qmake-environment-reference.html#customizing-makefile-output)...
These two variables may reveal interesting if you're looking for some automation : PRE_TARGETDEPS (http://doc.trolltech.com/4.3/qmake-variable-reference.html#pre-targetdeps) and POST_TARGETDEPS (http://doc.trolltech.com/4.3/qmake-variable-reference.html#post-targetdeps).

bhs-ittech
24th August 2007, 11:43
But aren't they just for libraries, and other build targets?

What I had in mind was something like zipping, moveing, and/or deleting files.

aMan
29th August 2007, 16:12
how could that be platform independant?

fullmetalcoder
29th August 2007, 16:19
how could that be platform independant?
By using a couple of scopes :


mytarget.target = ...
mytarget.depends = ...

unix {
mytarget.commands = ...
}

win32 {
mytarget.commands = ...
}

macx {
mytarget.commands = ...
}


Note : the last time I tried using this mechanism, everything worked fine except for a single thing : I did not see any difference between PRE_TARGETDEPS and POST_TARGETDEPS... Whatever I did, my additional target got processed BEFORE compilation... Is is me or is it a bug in qmake?

bhs-ittech
11th September 2007, 10:43
Thanks,
that cleared it up for me.
Now I'm able to do what I intended, and find the relevant information
in the documentation :)

Again thanks alot

wysota
11th September 2007, 12:00
Whatever I did, my additional target got processed BEFORE compilation... Is is me or is it a bug in qmake?

I think it is meant to be that way. At least that's what the docs suggest.

As far as I understand it, it is like this:

$(LINKER) $(PRE_TARGETDEPS) -o $(TARGET) $(POST_TARGETDEPS)

So both PRE and POST have to be built before the actual target. Those variables only determine the moment when they will be linked (the order of linked libraries is sometimes important).