Momergil
Momergil

Reputation: 2281

qmake is not reading my .pro correctly

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

Upvotes: 1

Views: 806

Answers (1)

Bill
Bill

Reputation: 11822

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'.

Upvotes: 1

Related Questions