qmake: how to supply multiple variables via command-line?

后端 未结 2 1505
梦如初夏
梦如初夏 2021-01-02 06:58

qmake allows to supply a variables via a command-line interface like this:

qmake \"CONFIG += release\" \"MY_VAR = hello\"

So i

相关标签:
2条回答
  • 2021-01-02 07:23

    The question is misleading. You CAN supply any number of variables.

    .pro file:

    ....
    message($$VAR1)
    message($$VAR2)
    

    qmake run:

    qmake ... "VAR1=VALUE1" "VAR2=VALUE2"
    

    compiler output:

    
    09:40:13: Running build steps for project test...
    09:40:13: Starting: "c:\qtsdk\desktop\qt\4.8.1\mingw\bin\qmake.exe" D:\tmp\test\test.pro -r -spec win32-g++ "CONFIG+=declarative_debug" "VAR1=VALUE1" "VAR2=VALUE2"
    Project MESSAGE: VALUE1
    Project MESSAGE: VALUE2
    Project MESSAGE: VALUE1
    Project MESSAGE: VALUE2
    Project MESSAGE: VALUE1
    Project MESSAGE: VALUE2
    09:40:14: The process "c:\qtsdk\desktop\qt\4.8.1\mingw\bin\qmake.exe" exited normally.
    
    0 讨论(0)
  • 2021-01-02 07:26

    qmake can access environment variables via $$() syntax (internal variables are accessed with $${} syntax). This can be used to pass any number of variables to qmake.

    0 讨论(0)
提交回复
热议问题