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 different qmake configuration depending on debug / release?
QtWS25 Last Chance

How to set different qmake configuration depending on debug / release?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 9.6k Views
  • 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.
  • E Offline
    E Offline
    eyeofhell
    wrote on last edited by
    #1

    Hello.

    I need to specify different output and intermediate folders in my .pro file for debug and release builds. I created a following test .pro file:
    @release {
    message( "release" )
    }
    debug {
    message( "debug" )
    }@

    But compiling this .pro file in Qt Creator with "debug" build leads to following output:

    Project MESSAGE: release
    Project MESSAGE: debug

    It seems that both "debug" and "release" conditions are set to True O_O. Is it possible to somehow handle debug and release builds separately in qmake?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Come on, it's a FAQ.
      @CONFIG(debug,debug|release)@

      http://developer.qt.nokia.com/faq/answer/how_to_deal_correctly_with_project_files_that_should_generate_a_debug_and_r

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • E Offline
        E Offline
        eyeofhell
        wrote on last edited by
        #3

        Thank you. I have examined the article carefully. The code:
        @CONFIG { message(Debug build) } else { message(Release build) }@
        simply don't work with error "Unexpected else".

        The next code sample,
        @build_pass:CONFIG {
        message(Debug build)
        }
        else:build_pass {
        message(Release build)
        }@
        Don't raise an error, but no message will be displayed since qmake don't have "build_pass" variable/condition defined :(.
        So, maybe you can clarify what exactly i need to write in my .pro file so message() will output "debug" at debug build and "release" at release build?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          Oh, wow. There's actually a parsing bug there. What I typed is correct, but if you omit the code markup, it becomes a tooltip for CONFIG (try hovering the mouse on it)...

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • E Offline
            E Offline
            eyeofhell
            wrote on last edited by
            #5

            Ah, i got it. It's
            @CONFIG(debug,debug|release) {
            message( debug )
            } else {
            message( release )
            }@

            Thanks again :)

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pathak85
              wrote on last edited by
              #6

              sEmpty(QT_BUILD_PARTS) { #defaults symbian
              {
              QT_BUILD_PARTS = libs tools examples demos
              } else {
              QT_BUILD_PARTS = libs tools examples demos docs translations
              }
              } else { #make sure the order makes sense
              contains(QT_BUILD_PARTS, translations) {
              QT_BUILD_PARTS -= translations
              QT_BUILD_PARTS = translations $$QT_BUILD_PARTS
              }
              contains(QT_BUILD_PARTS, tools) {
              QT_BUILD_PARTS -= tools
              QT_BUILD_PARTS = tools $$QT_BUILD_PARTS
              }
              unexpected else error hw to remove it

              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