I am putting together a build system for my Qt app using a qmake .pro file that uses the 'subdirs' template. This works fine, and allows me to specify the order that each target is built, so dependencies work nicely. However, I have now added a tool to the project that generates a version number (containing the build date, SVN revision, etc,) that is used by the main app - I can build this version tool first but when it is built I want to execute it before any more targets are built (it generates a header file containing the version number that the main app includes.)
For example, my simple qmake file looks like something this:
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = version \
lib \
tests \
mainapp
When 'version' is built I want to execute it (passing some arguments on the command-line) before 'lib' is built.
Does anyone know if this is possible? I see that qmake has a 'system' command that can execute apps, but I don't know how I could leverage this.
A related question concerns my unit tests. These live in the 'test' project and use the QTest framework. I want to execute the tests exe before building 'mainapp' and if the tests fail (i.e. the tests exe doesn't return zero) I want to quit the build process.
I realise that qmake is designed to generate makefiles, so I may be wishing for a little too much here but if anyone can give me some pointers it would be very welcome.