Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

qmake

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?

like image 914
grigoryvp Avatar asked Apr 13 '10 09:04

grigoryvp


2 Answers

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.
like image 163
Sergey Skoblikov Avatar answered Sep 28 '22 03:09

Sergey Skoblikov


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.

like image 22
grigoryvp Avatar answered Sep 28 '22 02:09

grigoryvp