PDA

View Full Version : qmake | .pro and -config



migel
3rd February 2012, 22:43
Thought specifying -config you can run the scoped code.


debug {
DEFINES += SD_DEV
message("debug")
}

release {
message("release")
}

qmake p.pro -config release
Project MESSAGE: debug
Project MESSAGE: release

Should I have only release message ?

ChrisW67
4th February 2012, 00:06
Both release and debug can be in CONFIG at the same time, and the last one wins (put CONFIG in a message to see the default). You want to use the CONFIG() function:

CONFIG(debug, debug|release) {
message("debug")
}

CONFIG(release, debug|release) {
message("release")
}

and then:


$ qmake test.pro
Project MESSAGE: release
$ qmake CONFIG+=debug test.pro
Project MESSAGE: debug
$ qmake CONFIG+=release test.pro
Project MESSAGE: release

migel
4th February 2012, 21:50
yeah, thanks, I found that. I just don't understand purpose of running both. What is that for then ?