I want to provide a make target that should be optional and not executed in normal build process, only if you explicitly specify it. Usually you specify that like this:
QMAKE_EXTRA_TARGETS += fooTarget
It is executed later like this:
make fooTarget
However my project is a subdirs project. The target only gets executed for the top level project, but not for sub projects.
You have to mark the target as recursive in the top level project file:
fooTarget.CONFIG = recursive
Now it will be executed for every sub project (but not their sub projects) when you run make fooTarget
. If the target does not exist in one sub project, make
will fail. The behavior can be changed to only execute the target on certain directories or to call a different target for sub projects. See Adding Custom Targets in the qmake documentation.