Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    3
    6
    9163
    Loading More Posts
    • 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
      eyeofhell last edited by

      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 Reply Quote 0
      • D
        dangelog last edited by

        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 Reply Quote 0
        • E
          eyeofhell last edited by

          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 Reply Quote 0
          • D
            dangelog last edited by

            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 Reply Quote 0
            • E
              eyeofhell last edited by

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

              Thanks again :)

              1 Reply Last reply Reply Quote 0
              • P
                pathak85 last edited by

                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 Reply Quote 0
                • First post
                  Last post