[Qt-interest] override variables with environment variables

Ferenc Stelcz ferenc at stelcz.hu
Sun May 17 11:58:34 CEST 2009


Lorenzo Bettini wrote:
> Hi
> 
> is there a way to override variables (such as, e.g., INSTALL_DIR) in 
> .pro files by using environment variables, e.g., something like this:
> 
> INSTALL_DIR="/my/path" qmake
> 
> ?
> 

According to the docs "qmake Advanced Usage" @ 
http://doc.trolltech.com/4.5/qmake-advanced-usage.html#variables

To obtain the contents of an environment value when qmake is run, use the 
$$(...) operator:

DESTDIR = $$(PWD)
message(The project will be installed in $$DESTDIR)

In the above assignment, the value of the PWD environment variable is read 
when the project file is processed.

To obtain the contents of an environment value at the time when the generated 
Makefile is processed, use the $(...) operator:

DESTDIR = $$(PWD)
message(The project will be installed in $$DESTDIR)

DESTDIR = $(PWD)
message(The project will be installed in the value of PWD)
message(when the Makefile is processed.)

In the above assignment, the value of PWD is read immediately when the project 
file is processed, but $(PWD) is assigned to DESTDIR in the generated 
Makefile. This makes the build process more flexible as long as the 
environment variable is set correctly when the Makefile is processed.

etc.

HTH ;)

--
Ferenc Stelcz
Junior Software Engineer

Banyan Technologies LLC.


__________ Information from ESET Smart Security, version of virus signature database 4080 (20090515) __________

The message was checked by ESET Smart Security.

http://www.eset.com





More information about the Qt-interest-old mailing list