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

grigoryvp picture grigoryvp · Apr 13, 2010 · Viewed 12.6k times · Source

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

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

So i can use $$MY_VAR inside a .pro file. But is it possible to suply more than one variable such way? I have tried

qmake "CONFIG += release" "MY_VAR = hello" "MY_ANOTHER_VAR = hi"

But it did not work (raises error). Any hints?

Answer

Sergey Skoblikov picture Sergey Skoblikov · Aug 9, 2012

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.