QMake. Legendary scope switch CONFIG(debug, debug|release)
Hy,
I and many other developers came to this point, when project debug and release versions must have some different config. In QMake docs everything seems very easy … just use “debug { … }” or “release { … }” and you have what you want, but that that’s not so easy if one is using QtCreator.
For half of day I was searching for normal explanation in the internet what a heck these parameters mean in the config function: “CONFIG (debug, debug|release)” or “CONFIG (release, debug|release)”. There is some info in QMake docs but it does not make much sense for me. What exactly the second parameters does??
1 reply
Here’s a little test .pro:
- CONFIG(debug) {
- message(debug)
- }
- CONFIG(release) {
- message(release)
- }
- CONFIG(debug, debug|release) {
- message("debug, debug|release")
- }
- CONFIG(release, debug|release) {
- message("release, debug|release")
- }
With the outputs:
- $ qmake
- Project MESSAGE: debug
- Project MESSAGE: release
- Project MESSAGE: debug, debug|release
- $ qmake CONFIG-=release CONFIG+=debug
- Project MESSAGE: debug
- Project MESSAGE: debug, debug|release
- $ qmake CONFIG-=release CONFIG-=debug
- $ qmake CONFIG+=release CONFIG-=debug
- Project MESSAGE: release
- Project MESSAGE: release, debug|release
The second parameter seems to be which configuration options to check for. If I change the last check into
- CONFIG(release, debug|unrelease) {
- message("release, debug|release")
- }
- $ qmake CONFIG+= release CONFIG-=debug
- Project MESSAGE: release
If I change the check into
- CONFIG(release, release) {
- message("release, debug|release")
- }
I get
- $ qmake CONFIG+=release CONFIG+=debug
- Project MESSAGE: debug
- Project MESSAGE: release
- Project MESSAGE: debug, debug|release
- Project MESSAGE: release, debug|release
Besides specifying the items to check for, some seem to take precedence. I’m not all too sure how this is determined. Anyway, I hope this at least clarifies something.
You must log in to post a reply. Not a member yet? Register here!
