Qt – How to set different qmake configuration depending on debug / release

qt

I need to specify different output and intermediate folders in my .pro file for debug and release builds. I created a following test .pro file:

release {
  message( "release" )
}
debug {
  message( "debug" )
}

But compiling this .pro file in Qt Creator with “debug” build leads to following output:

Project MESSAGE: release
Project MESSAGE: debug

It seems that both “debug” and “release” conditions are set to True O_O. Is it possible to somehow handle debug and release builds separately in qmake?

Best Answer

According to the qmake manual:

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

I don't really get the explanation, though. It seems that both of the options are really selected, and only one of them is "active". But qmake is famous for counter-intuitive things.