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. Problem with qmake equals()/isEqual()

Problem with qmake equals()/isEqual()

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 3 Posters 6.4k 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.
  • P Offline
    P Offline
    pierrevr
    wrote on last edited by
    #1

    Hi,

    I have a problem using the equals()/isEqual() function.
    I must not have understood it well, because after seeing that it behaved differently than I thought, I inserted the following code into my .pro to test it out:
    @
    equals(MY_ENV_VAR,foobar) {
    system(echo "OK 1")
    }
    equals($MY_ENV_VAR,foobar) {
    system(echo "OK 2")
    }
    equals($$MY_ENV_VAR,foobar) {
    system(echo "OK 3")
    }
    system(echo "var = $MY_ENV_VAR")
    @

    And after "export MY_ENV_VAR=foobar", I run make distclean & re-run the qmake and make files... and the result is, that all 3 tests fail, but it prints out "var = foobar" correctly.

    What am I doing wrong here?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

      To use environment variable you have to use $$() instead of $$.
      Try:
      @error($$(PATH))@

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pierrevr
        wrote on last edited by
        #3

        Hi, p-himik;

        In fact, that was my first try, after reading the manual. But I thought that it didn't work.

        The problem was, though, that equals can not take an argument like: $$(...)

        So this is not possible:

        @
        equals($$(MY_ENV_VAR), foo)
        @

        On the advice of peppe, I got it working by storing the value in another qmake variable, and then doing the comparison on that second variable instead of the original.

        Thank you for your help,
        Pierre

        1 Reply Last reply
        0
        • PekkaP Offline
          PekkaP Offline
          Pekka
          wrote on last edited by SGaist
          #4

          This is just clarification to old post about comparing environment variables within qmake (still being viewed), and also about cheking android architecture:

          MY_TMP = $ $(ANDROID_NDK_TOOLCHAIN_PREFIX)
          equals(MY_TMP,x86){
          

          Notice two $$ before (AND…

          [edit: added space between the two $ signs, to be removed in real code. SGaist]

          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