QtCreator is a bit different than using straight qmake as it defines a "debug_and_release" flag in the CONFIG variable by default. You can query this flag for "debug" or "release" by specifying
CONFIG(debug, debug|release) {
#debug code here
}
CONFIG(debug, debug|release) {
#debug code here
}
To copy to clipboard, switch view to plain text mode
or conversely...
CONFIG(release, debug|release) {
#release code here
}
CONFIG(release, debug|release) {
#release code here
}
To copy to clipboard, switch view to plain text mode
What I do in my own QtCreator projects is convert the "debug_and_release" flag into the separate "debug" and "release" flags by doing this...
# ensure one "debug_and_release" in CONFIG, for clarity...
debug_and_release {
CONFIG -= debug_and_release
CONFIG += debug_and_release
}
# ensure one "debug" or "release" in CONFIG so they can be used as
# conditionals instead of writing "CONFIG(debug, debug|release)"...
CONFIG(debug, debug|release) {
CONFIG -= debug release
CONFIG += debug
}
CONFIG(release, debug|release) {
CONFIG -= debug release
CONFIG += release
}
# ensure one "debug_and_release" in CONFIG, for clarity...
debug_and_release {
CONFIG -= debug_and_release
CONFIG += debug_and_release
}
# ensure one "debug" or "release" in CONFIG so they can be used as
# conditionals instead of writing "CONFIG(debug, debug|release)"...
CONFIG(debug, debug|release) {
CONFIG -= debug release
CONFIG += debug
}
CONFIG(release, debug|release) {
CONFIG -= debug release
CONFIG += release
}
To copy to clipboard, switch view to plain text mode
Hope that helps,
~ andy.f
Bookmarks