Hekx Hekx - 3 months ago 8
C++ Question

Entering scopes in template lib

In a C++/Qt project, we are using .pro-files and qmake to build. Part of the project is a static lib. The .pro file goes like this:

TEMPLATE = lib
CONFIG = staticlib

#general build instructions

linux{
#some os-specific build instructions
}
win32|win64{
#some os-specific build instructions
}


However, these scopes are never entered, not on a linux system (when the first scope should execute), nor on a windows system (for the second scope).

This only appears to be a problem in the staticlib-configuration/lib-template.

The Qt-documentation mentions the different templates, but I do not see anything mentioned as to why scopes would not work or how to solve this.

kmm kmm
Answer

Those conditions are true if they're set in the CONFIG variable. By overwriting CONFIG with staticlib, you reset all preset flags, including the ones specifying the platform.

It should work if you do CONFIG += staticlib