Does Qt Creator understand debug/release scopes in .pro files?
If in a .pro file, I use the following
Code:
win32 {
debug {
DESTDIR = ../build_win32/debug
} else {
DESTDIR = ../build_win32/release
}
}
Qt Creator will always look for the executable to run/debug in the ../build_win32/release directory, as if the "debug" scope was never active. The same happens removing the outer "win32 { ... }" condition or swapping the inner conditions and using "release" instead. I have tried "debug", "Debug", "DEBUG", "_DEBUG": none seems to be known to Qt Creator.
The build process in itself is correct (the executable ends up in the right directory), but launching the executable with F5, Qt Creator always looks for it in the 'else-d' directory and, of course, while attempting to debug, it finds nothing.
The same is true under Linux (of course replacing or removing the win32 condition!). I'm using Qt Creator 1.2.1 with Qt 4.5.2 32bit under XP SP3 or Ubuntu Jaunty.
Any suggestion would be appreciated.
M.
P.S.: I know that the "Shadow build" option would be a work-around, but I'm attempting to avoid using it as this setting cannot be set independently for each platform.
Re: Does Qt Creator understand debug/release scopes in .pro files?
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
Code:
CONFIG(debug, debug|release) {
#debug code here
}
or conversely...
Code:
CONFIG(release, debug|release) {
#release code here
}
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...
Code:
# 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
}
Hope that helps,
~ andy.f
Re: Does Qt Creator understand debug/release scopes in .pro files?
Great, it DOES work!!
Thank you!
M.