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. [SOLVED] qmake: How to define 2 conditions for the same instruction
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qmake: How to define 2 conditions for the same instruction

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 1.9k 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.
  • X Offline
    X Offline
    xtingray
    wrote on last edited by
    #1

    Hi,

    I am trying to define 2 conditions for the same instruction in my project.pro file, but it doesn't work. I have tried this syntax approach:
    @
    unix {
    contains(DEFINES, K_DEBUG) {
    SUBDIRS += debug
    }
    }
    @

    And this one:

    @
    contains(DEFINES, K_DEBUG) {
    unix:SUBDIRS += debug
    }
    @

    But it is not working. If I try both conditions in separated blocks, then it works.

    So, what I'm doing wrong? Is there a way to make it works?

    Thanks for any hint or suggestion! :)


    Qt Developer

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xtingray
      wrote on last edited by
      #2

      By the way, this is the content of my project.pro file:

      @
      TEMPLATE = subdirs
      SUBDIRS += interface

      unix {
      contains(DEFINES, K_DEBUG) {
      SUBDIRS += debug
      }
      }
      @


      Qt Developer

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ckakman
        wrote on last edited by
        #3

        Hi,

        Some qmake variables behave differently than others when conditionals are used. Could try the following trick?

        @
        unix {
        contains(DEFINES, K_DEBUG) {
        DEFINES += ADD_DEBUG_SUBDIR
        }
        }

        contains(DEFINES, ADD_DEBUG_SUBDIR) {
        SUBDIRS += debug
        }
        @

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xtingray
          wrote on last edited by
          #4

          I still can't believe the way I got it to work. Look:

          @
          unix {
          contains(DEFINES, K_DEBUG) {
          SUBDIRS += debug
          }
          }
          @

          All I had to do was to remove the indentation spaces and now it works perfectly. I can't believe the syntax analyzer of qmake is so inflexible :(

          Problem solved... but... jesus! :S


          Qt Developer

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ckakman
            wrote on last edited by
            #5

            Would you consider submitting a bug report for qmake on the "bug tracker":https://bugreports.qt-project.org/browse/QTBUG ?

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xtingray
              wrote on last edited by
              #6

              Done! But the text editor of the bug tracker didn't help me to explain the problem, so I linked this thread.

              Here is the ticket:
              https://bugreports.qt-project.org/browse/QTBUG-43654

              Thanks!


              Qt Developer

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ckakman
                wrote on last edited by
                #7

                The editor there is in fact more capable. You can click the ? button below the editing window and see all the formatting options.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xtingray
                  wrote on last edited by
                  #8

                  Ok, I enhanced the text... but what horrible text editor!!! (even with the help dialog). The user experience of this forum is much better!


                  Qt Developer

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xtingray
                    wrote on last edited by
                    #9

                    After running several tests, it seems this bug finally was related to another hidden bug:

                    https://bugreports.qt-project.org/browse/QTBUG-491

                    Any way, thanks for your help! :)


                    Qt Developer

                    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