How to set different qmake configuration depending on debug / release?
-
Hello.
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: debugIt 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?
-
Come on, it's a FAQ.
@CONFIG(debug,debug|release)@ -
Thank you. I have examined the article carefully. The code:
@CONFIG { message(Debug build) } else { message(Release build) }@
simply don't work with error "Unexpected else".The next code sample,
@build_pass:CONFIG {
message(Debug build)
}
else:build_pass {
message(Release build)
}@
Don't raise an error, but no message will be displayed since qmake don't have "build_pass" variable/condition defined :(.
So, maybe you can clarify what exactly i need to write in my .pro file so message() will output "debug" at debug build and "release" at release build? -
sEmpty(QT_BUILD_PARTS) { #defaults symbian
{
QT_BUILD_PARTS = libs tools examples demos
} else {
QT_BUILD_PARTS = libs tools examples demos docs translations
}
} else { #make sure the order makes sense
contains(QT_BUILD_PARTS, translations) {
QT_BUILD_PARTS -= translations
QT_BUILD_PARTS = translations $$QT_BUILD_PARTS
}
contains(QT_BUILD_PARTS, tools) {
QT_BUILD_PARTS -= tools
QT_BUILD_PARTS = tools $$QT_BUILD_PARTS
}
unexpected else error hw to remove it