How to set compiler directives per build configuration



  • I have the following in my .pro file to send the -DDEBUG directive when I am using the debug configuration:
    @CONFIG (debug)
    {
    DEFINES += DEBUG
    }@

    When I compile I get the following output, which I would expect

    g++ -c -pipe -g -fPIC -Wall -W -D_REENTRANT -DDEBUG ...

    The problem is that when I want to build a release version of my program, the -DDEBUG is still showing up when I compile even though it appears that the rest of the output is as I would expect

    g++ -c -pipe -O2 -fPIC -Wall -W -D_REENTRANT -DDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED...

    I'm using the DEBUG directive provide debugging output to the screen as well as intermediate files which will not be available for my release version.

    Any help would be greatly appreciated.



  • I don something like this,

    @

    CONFIG(debug, debug|release) {
    CONFIG_SUFFIX = Debug
    DEFINES += _DEBUG
    } else {
    CONFIG_SUFFIX = Release
    }

    @



  • That did it.

    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.