This is kind of a continuation of this question . I want to run
win32:LIBS ~= s/-l(.*)/-l\1d/g
only for debug builds, since the idea is to appen d
to lib names in debug mode.
I tried
win32:debug:LIBS ~= s/-l(.*)/-l\1d/g
But so it also executes in release mode.
You need to use CONFIG(debug, debug|release)
instead of a simple test for presence of debug
. The CONFIG
variable is special, in that it can have multiple debug
and release
entries in it, but only the last one counts .
So, even in release mode, your CONFIG might look like something, debug, something, release
: the release
"wins" since it's the last, but the scope test doesn't know that.
It's a quirk of qmake. It is even documented, if you know where to look first :/
As the order of values is important in CONFIG variables (that is, the last one set will be considered the active config for mutually exclusive values) a second parameter can be used to specify a set of values to consider. For example:
Thats how I do it normally:
CONFIG(debug, debug|release) {
unix: TARGET = $$join(TARGET,,,d)
win32: TARGET = $$join(TARGET,,,d)
}
platform is present because initially I thought to use different conventions for different platforms and giving here just as an example
you can add this rule right after you set a target name for libs/apps
normal layout have this rule in the .pro file for generation your library and something like:
CONFIG(debug, debug|release) {
unix: LIBS += -L../libs -L../../libs -lyourlibnamed
win32: LIBS += -L../libs -L../../libs -lyourlibnamed
} else {
unix: LIBS += -L../libs -L../../libs -lyourlibname
win32: LIBS += -L../libs -L../../libs -lyourlibname
}
in a .pri file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.