While streamlining the build process of a Qt project, I came across a couple of excellent articles about qmake. They pick up where the official qmake documentation left off.
If you ever tried to write a custom compiler for QMAKE_EXTRA_COMPILERS or a custom target for QMAKE_EXTRA_TARGETS, you’ll find the QMake documentation about Advanced Usage lacking. It doesn’t tell you which variables you can use in the definition of custom compilers and which properties are admissible for custom compilers.
All the available properties and variables are listed and explained meticulously in the article Undocumented QMake. Additionally, the article gives quite a few examples. This article is the ultimate reference about the advanced usage of qmake.
This article is a true classic written by Andy Shaw, the long-time head of Qt’s support team, in 2008! Andy explains in detail how to write a custom compiler and a custom target based on useful examples. I have seen his example of a target for generating the latest binary translation files (.qm files) in quite a few projects.
If you combine this article with the article Undocumented QMake, you have everything you need for custom compilers and targets.
And, you certainly don’t want any dead kittens. Robin Burchell makes a strong point against using CONFIG+=ordered in a subdirs project. If you use CONFIG+=ordered, sub-projects are built sequentially. Your powerful and shiny computer cannot fully utilise its four or eight cores for a parallel build. You get faster builds if you specify the dependencies between the sub-targets with the depends property. This leaves more freedom for optimisations by a parallel build.
My application links against a static library consisting of some QML, C++ and resource files. When I changed a QML file, the resource file or a C++ source file, the static library is rebuilt correctly. However, my application is not rebuilt. Hence, my application doesn’t contain the latest version of the static library but an old version.
The way to change this is to make the application dependent on the static library with the following statement in the application’s project file.
PRE_TARGETDEPS += path/to/static/lib.a
(Note that TARGETDEPS as given in the answer of the linked StackOverflow question doesn’t exist any more.)
With this statement, the application is relinked whenever the static library is rebuilt.