Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set compiler directives per build configuration
Qt 6.11 is out! See what's new in the release blog

How to set compiler directives per build configuration

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GoDonkeys
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      steno
      wrote on last edited by
      #2

      I don something like this,

      @

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

      @

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GoDonkeys
        wrote on last edited by
        #3

        That did it.

        Thanks!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved