1

Recently I notice a compilation problem in one of my projects (see some comments about it here, but notice it's not necessary to read that post). After some work, I did managed to find the problem: it would seem my qmake is not reading my .pro file accordingly, more specifically in a given moment where a include some specific libs under "debug" or "release" scope:

win32 {
    LIBS += -lpsapi

    debug {
        LIBS += C:/Qt/Qwt-6.1.0/lib/qwtd.dll \
            $${MLOGGER}/build/debug/mLogger.dll \      
            $${MSHARE_LIB}/build/debug/mShareLib.dll  
        DEFINES += DEBUG
    }

    release {
        LIBS += C:/Qt/Qwt-6.1.0/lib/qwt.dll \
            $${MLOGGER}/build/release/mLogger.dll \
            $${MSHARE_LIB}/build/release/mShareLib.dll
        DEFINES += RELEASE \
           QT_NO_DEBUG \
           QT_NO_DEBUG_OUTPUT
    }
} # win32

In accordance to the Qt Assistant, the above code should be valid. Here is one of the examples of nested scopes that Qt Assistant provides as a valid code:

win32 {
    debug {
        CONFIG += console
    }
}

What could be wrong? :( I have no idea. I don't remember finding any configuration in Qt Creator or somewhere else where such "qmake feature" was disabled.

I'm glad for any help.

Momergil

Community
  • 1
  • 1
Momergil
  • 2,213
  • 5
  • 29
  • 59
  • See [How to set different qmake configuration depending on debug / release?](http://stackoverflow.com/q/5134245/26449) and [QMake CONFIG() function and 'active configuration'](http://stackoverflow.com/q/18164490/26449) – Bill May 29 '14 at 05:30
  • @Bill thanks for the reply. I'll try this alternative option. – Momergil May 29 '14 at 11:36
  • @Bill well it certainly did work :) Thanks for the comment, but I'll maintain the question open so someone may appear exaplaining why the show method didn't work. – Momergil May 30 '14 at 02:42

1 Answers1

1

Scopes and the CONFIG variable are closely related. As you can read in the manual:

The values stored in the CONFIG variable are treated specially by qmake. Each of the possible values can be used as the condition for a scope.

So using a debug scope is equivalent to testing if debug is placed into the CONFIG variable. And using a release scope is equivalent to testing if release is placed into the CONFIG variable. Unfortunately the CONFIG variable can contain conflicting options, such as both release and debug! It is not enough to know if debug is in CONFIG or release is in CONFIG because both can be in CONFIG. What you need to know is which option is the active. Further explanation can be found in here: QMake CONFIG() function and 'active configuration'.

Community
  • 1
  • 1
Bill
  • 11,595
  • 6
  • 44
  • 52
  • thanks Bill for the full explanation :) It really makes sense (quite unfortunately the Qt Assistant files doesn't address this point, at least AFAIK). – Momergil May 30 '14 at 11:06