Reputation: 4297
For my Qt project, I have the normal debug and release build configurations using the standard version of qmake, however I also need to build static (Windows 64-bit) versions of my project using a different, static build of qmake. I am currently doing the static build using the command line and a separete .pro file, however I would prefer to do this with the same .pro file I use for the non-static versions, and from within Qt creator if possible.
I have already created a kit for the static version of qmake, my problem now is that I can't get qmake to link my project against the proper libraries (I have separate library versions for debug, release, and static builds). My pro file looks like this:
CONFIG(debug, debug|release|static ) {
#debug build
LIBS += ../third-party-library/debug/library.lib
}
CONFIG( release, debug|release|static ) {
CONFIG(static, debug|release|static) {
#static release build
LIBS += ../third-party-library/static/library.lib
} else {
#non-static release build
LIBS += ../third-party-library/release/library.lib
}
}
In the project settings for the release build, I'm calling qmake like this:
qmake.exe MyProject.pro -spec win32-msvc "CONFIG+=static"
My question is how do I add an additional build configuration besides the usual debug/release ones, and how do I specify specific libraries for it?
Upvotes: 2
Views: 1442
Reputation: 7146
I think your qmake definition is a little of. The CONFIG(debug, debug|release)
syntax is a special construct, as always both are defined, and this finds out witch build is actually used. For static, thats not the case, so simply define it as:
CONFIG(debug, debug|release ) {
#debug build
LIBS += ../third-party-library/debug/library.lib
} else:CONFIG(release, debug|release) {
static {
#static release build
LIBS += ../third-party-library/static/library.lib
} else {
#non-static release build
LIBS += ../third-party-library/release/library.lib
}
}
For why this does not work with debug
and release
and thus the special construct is needed, read here: https://doc.qt.io/qt-5/qmake-test-function-reference.html#config-config
Using static
like that only works because qmake reads such conditions from the CONFIG
variable. It's basically short for contains(CONFIG, static)
.
Upvotes: 2