How to set different qmake configuration depending on debug / release?
-
wrote on 27 Feb 2011, 12:26 last edited by
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?
-
wrote on 27 Feb 2011, 13:49 last edited by
Come on, it's a FAQ.
@CONFIG(debug,debug|release)@ -
wrote on 27 Feb 2011, 14:41 last edited by
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? -
wrote on 27 Feb 2011, 16:17 last edited by
Oh, wow. There's actually a parsing bug there. What I typed is correct, but if you omit the code markup, it becomes a tooltip for CONFIG (try hovering the mouse on it)...
-
wrote on 27 Feb 2011, 16:23 last edited by
Ah, i got it. It's
@CONFIG(debug,debug|release) {
message( debug )
} else {
message( release )
}@Thanks again :)
-
wrote on 14 May 2013, 07:42 last edited by
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