- All (478)
- jom (0)
- Qt Linguist (7)
- Qt Eclipse Integration (9)
- Qt Designer (7)
- Qt Creator (4)
- Qt build system: qmake (31)
- Qt build system: configure (3)
- Qt Assistant (5)
- Printing (4)
- Porting from Qt 3 to Qt 4 (1)
- Plugins (7)
- Qt Visual Studio AddIn (2)
- Qt/MFC Migration (2)
- QtScript (3)
- MDI (2)
- XML (1)
- Widgets (22)
- WebKit (5)
- Tools and Containers (2)
- Threads (2)
- Text Handling (10)
- SQL (6)
- QtTest (1)
- QtService (1)
- Platform: Windows (49)
- Platform: Unix (16)
- Platform: Mac OS X (18)
- Image Formats (2)
- I/O (2)
- Graphicsview (8)
- Font handling (9)
- Event System (18)
- Drag and Drop (4)
- Dialogs (6)
- Desktop integration (3)
- ActiveQt (3)
- Itemviews (60)
- Layout (4)
- Qt Quick (10)
- Qt SDK (1)
- Licensing (2)
- Platform: Embedded Linux (38)
- Painting (32)
- OpenGL (4)
- Object Model (6)
- Network (5)
- Multimedia (3)
- Miscellanous (23)
- Main Window (19)
- Look and Feel (23)
- Development (0)
- Getting Involved (0)
- Routines (0)
What does the syntax CONFIG(debug,debug|release) mean ? What does the 1st argument specify and similarly what is the 2nd ?
When qmake [doc.qt.nokia.com] processes a pro file it could process it up to three times depending on what the configuration is set to. Usually it will do it three times. Once for debug, once for release and one final one for debug_and_release. This is so that both configurations can be generated for at the same time. Therefore when it is required to have debug/release specific settings in a pro file then there is a need to check if qmake is processing the pro file with a particular configuration in mind. As “debug” and “release” might be in CONFIG at the same time a check for just debug or release is likely to always be true (particularly if you have debug_and_release enabled). So, this construct
- CONFIG(debug, debug|release) {
- HEADERS += debug.h
- SOURCES += debug.c
- }
checks for when the debug configuration is being processed comparing where “debug” and “release” are mutually exclusive. As CONFIGs are order dependent (ie the last one set will be considered the active config for mutual exclusive sets like debug and release) a second parameter can be used to specify a set of values to consider, for example:
- CONFIG = debug
- CONFIG += release
- CONFIG(release, debug|release):message(Release build!)#will be displayed
- CONFIG(debug, debug|release):message(Debug build!) #not displayed
Note that you should use the build_pass [doc.qt.nokia.com] variable to filter out messages, otherwise you will get messages when it creates the Makefile which will be the configuration specific makefile. When adding the build_pass variable in conjunction with the following scope
- build_pass:CONFIG(debug, debug|release) {
- message(Debug bulid)
- }
- else:build_pass {
- message(Release build)
- }
the output will be as follows:
Project MESSAGE: Debug build
Project MESSAGE: Release build

1 comment
August 29, 2012
Lab Rat
Typo: “(Debug bulid)”