Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QMake 'debug' bug

QMake 'debug' bug

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 3 Posters 2.3k Views 3 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.
  • T Offline
    T Offline
    tommy
    wrote on last edited by
    #1

    I have not been able to build release code with Qt 5.5, and now I think I know why:
    QMake is not handling 'debug' in CONFIG properly. For example with this code in the .pro file:
    CONFIG(debug){ DEFINES += foobar }
    I get -Dfoobar in makefiles generated for both debug and release builds, regardless of whether the QMake command line contains "CONFIG+=debug".

    I have many library selections that are supposed to be conditional on CONFIG(debug); but only the debug selections are actually getting into the makefiles.

    It is not as if QMake is totally ignoring "CONFIG+=debug", because some elements of the makefile change when it is present, for example this:
    qmake: FORCE
    @$(QMAKE) -spec win32-msvc2013 "CONFIG+=debug" -o Makefile.Release ..\match_wrangler\PT3D.pro
    which is absurd but might be evidence of something.

    HELP! I need a workaround, and fast.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @tommy said:

      CONFIG(debug){ DEFINES += foobar }

      This should be CONFIG(debug, debug|release){ DEFINES += foobar } for debug-only stuff and CONFIG(release, debug|release){ DEFINES += foobar } for release-only stuff.

      1 Reply Last reply
      1
      • T Offline
        T Offline
        tommy
        wrote on last edited by tommy
        #3

        Thanks, Chris

        That seems to give correct makefiles.

        Would you mind explaining the syntax (the qmake manual doesn't)?

        1 Reply Last reply
        0
        • Paul ColbyP Offline
          Paul ColbyP Offline
          Paul Colby
          wrote on last edited by Paul Colby
          #4

          @tommy said:

          Would you mind explaining that syntax (the qmake manual doesn't)?

          The documentation (albeit terse) is at http://doc.qt.io/qt-5/qmake-test-function-reference.html#config-config

          Cheers.

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Would you mind explaining the syntax (the qmake manual doesn't)?

            I consider it one of the oddities of qmake. The way I understand it CONFIG() function with one parameter just checks if given argument is present in the CONFIG variable, so if you have something like CONFIG += release debug both CONFIG(release) and CONFIG debug will match, so this is not enough.
            The active configuration is determined by the last occurrence of the parameter debug or release in the CONFIG variable, so CONFIG = debug release would be a release build while CONFIG = debug release debugwould be a debug build.
            The second parameter is used to find the last occurrence of it. The syntax debug|release means to look for the last instance of either word debug or release. Then the first parameter of CONFIG is matched against that, not the whole CONFIG variable.

            So for example if CONFIG = debug release (a release build) a second param of function CONFIG(debug, debug|release) would give you release and then the first parameter is matched against that, so the result is false.

            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