Qt Creator CONFIG switches (debug, release) DO NOT work

Problem: CONFIG (debug, debug | release) and CONFIG (release, deubg | release) are always evaluated wherever debugging or release is selected in Qt Creator 2.8.1 for Linux.

My configuration in Qt Creator application (availability is the default for a new project):

Projects->Build Settings->Debug Build Steps: qmake build configuration: Debug Effective qmake call: qmake2 proj.pro -r -spec linux-gnueabi-oe-g++ CONFIG+=debug Projects->Build Settings->Release Build Steps: qmake build configuration: Release Effective qmake call: qmake2 proj.pro -r -spec linux-gnueabi-oe-g++ 

My configuration in proj.pro:

 message(Variable CONFIG:) message($$CONFIG) CONFIG(debug,debug|release) { message(Debug build) } CONFIG(release,debug|release) { message(Release build) } 

Debug console output:

 Project MESSAGE: Variable CONFIG: Project MESSAGE: lex yacc warn_on debug uic resources warn_on release incremental link_prl no_mocdepend release stl qt_no_framework debug console Project MESSAGE: Debug build Project MESSAGE: Release build 

Output on console for release:

 Project MESSAGE: Variable CONFIG: Project MESSAGE: lex yacc warn_on uic resources warn_on release incremental link_prl no_mocdepend release stl qt_no_framework console Project MESSAGE: Debug build Project MESSAGE: Release build 

On Windows 7, I had no problems with this .pro configuration, and it worked fine. I was a desperate and modified .pro file:

 CONFIG = test message(Variable CONFIG:) message($$CONFIG) CONFIG(debug,debug|release) { message(Debug build) } CONFIG(release,debug|release) { message(Release build) } 

and I was surprised by the output:

 Project MESSAGE: Variable CONFIG: Project MESSAGE: test Project MESSAGE: Debug build Project MESSAGE: Release build 

therefore, even if I completely clear the CONFIG variable, it still sees the debug and release configuration.

What am I doing wrong?

+7
linux windows qt qt-creator
source share
1 answer

Qmake is crazy, this is the only viable explanation. All release / debugging, which is in the configuration several times, smells like an old design error that was never resolved before it was too late, and too many configurations have already been written. Remember the tabs in make? The dude had 15 users, so he never fixed bad decisions.

Anyway.

I see the same problem on linux, on Qt 4.8.4.1.

And here is the solution: remove the line break before the brace.

Literally this works:

 CONFIG(release, debug|release) { message(Release) } CONFIG(debug, debug|release) { message(Debug) } 

So far this is not the case:

 CONFIG(release, debug|release) { message(Release) } CONFIG(debug, debug|release) { message(Debug) } 

I suspect this is a parsing error in several versions of qmake, possibly only on the Linux side.

+18
source share

All Articles