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 CONFIG variables with values

qmake CONFIG variables with values

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 602 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.
  • M Offline
    M Offline
    Marc_Van_Daele
    wrote on last edited by
    #1

    Is it possible to add to CONFIG variables with values?

    Eg something like

    CONFIG += FOO=1
    
    FOO==1 {
       message("foo is 1")
    }
    
    FOO==2 {
       message("foo is 2")
    }
    

    When doing so, I get the error Excess closing brace.

    Obviously, I could use CONFIG += FOO1 and FOO1 {...} but I want to make sure that the values of FOO are exclusive and that

    CONFIG += FOO=1
    CONFIG += FOO=2
    

    results in FOO==2.

    Is this possible with qmake?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, no.

      Can you explain what you are trying to achieve using CONFIG like that ?

      Your code does not look like it needs to have that stored in CONFIG.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • M Offline
        M Offline
        Marc_Van_Daele
        wrote on last edited by
        #3

        I want to build different assets from a single .pro file (so I want to set different SOURCES, INCLUDES, ...). CONFIG seemed to be the most 'logical' way to me.

        However, I noticed that I can achieve what I want using the following snippet

        FOO = 1
        FOO = 2  
        
        contains (FOO, 1) {
            message("FOO is 1")
        }
        contains (FOO, 2) {
            message("FOO is 2")
        }
        
        1 Reply Last reply
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          CONFIG is rather to enable features.

          If you want control like that, your current solution is better.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved