PDA

View Full Version : qmake post compile step



h0nki
3rd June 2009, 08:24
Hello,
how is it possible to do a custom compile step in the .pro file after each step (compiling cpp file)?

fullmetalcoder
3rd June 2009, 22:09
You can create custom "compilers" (http://doc.trolltech.com/4.5/qmake-variable-reference.html#qmake-extra-compilers) (generic term : uic, rcc and moc are compilers in qmake terms) to handle the content of variables or you create extra targets (http://doc.trolltech.com/4.5/qmake-variable-reference.html#qmake-extra-targets) and specify whether they should be executed before (http://doc.trolltech.com/4.5/qmake-variable-reference.html#pre-targetdeps)or after (http://doc.trolltech.com/4.5/qmake-variable-reference.html#post-targetdeps)compilation. All this is explained relatively clearly (http://doc.trolltech.com/4.5/qmake-environment-reference.html#customizing-makefile-output)in the docs (http://doc.trolltech.com/4.5/qmake-manual.html).

h0nki
5th June 2009, 15:11
I just found how to execute commands after / before the linking step.
I want something in the Makefile like:


a.cpp: a.h
gcc -c a.cpp -o a.o
<new command>

b.cpp: b.h a.h
gcc -c b.cpp -o b.o
<new command>

While <new command> should be a command that i want to enter
this command should be after each gcc command.
I just found QMAKE_RUN_CXX, but i know, whether this is the right choice or not, because it does not work.

fullmetalcoder
7th June 2009, 09:49
Did you take the trouble to follow the link on custom compilers above? This approach can satisfy your needs. It will require extra care to keep everything cross-platform though as you want to mess with SOURCES variable but it's doable for sure.