[SOLVED] How can I add extra configs to a subproject at run time?
-
I have a project that depends on an external lib, structured like this:
@
project/
project.pro
3rdparty/
3rdparty.pro
the_lib_I_depend_on
src/
src.pro
@both project.pro and 3rdparty.pro are subdir projects. src.pro is the one that really builds the application.
The lib is itself a working qmake project, producing a dynamic-linked library, but instead of installing it to the target machine I want to statically linked to it instead.
I know that I can add CONFIG += staticlib to the lib's .pro file to make it produce a static lib, but I would prefer not to modify the project itself, so that I can include the project as a git submodule directly. But is it possible? How? Adding CONFIG += staticlib in neither project.pro nor 3rdparty.pro works.
-
I just came up with an another solution with ".qmake.cache and QMAKE_SUBSTITUTES":http://qt-project.org/wiki/QMake-top-level-srcdir-and-builddir . I put file .qmake.cache.in containing CONFIG+=staticlib in my 3rdparty directory, and added an extra rule QMAKE_SUBSTITUTES+=.qmake.cache in 3rdparty.pro. Seems like a a better solution for me since I don't need to remember typing qmake CONFIG+=staticlib anymore.
And this can probably solve the selected subdir problem I mentioned in the previous comment. You can make a new job that generates qmake.cache.in files at runtime in selected paths, and make 3rdparty.pro depend on it. Haven't try it, but seems like it would work.