[Qt-creator] system enviroment variables

Lincoln Ramsay lincoln.ramsay at nokia.com
Wed May 9 03:15:26 CEST 2012


On 05/09/2012 05:44 AM, ext Mohammad Mirzadeh wrote:
> I'm having difficulty using my system enviroment variables inside the
> .pro file.

What platform are you on?

> I've tried both
>
> INCLUDEPATH += $$(HEADER_DIR)

This evaluates when qmake is run.

> INCLUDEPATH +=$$system(echo $HEADER_VAR)

This is roughly equivalent (but it launches a sub-shell rather than just 
querying the environment), it evaluates when qmake is run. I'd recommend 
the first notation over this one.

> None of them works and Creator cannot parse. Is this possible at all or
> do I need to copy paste the value of the variables in the .pro file?

It depends on the platform.

If you start Creator from a shortcut then it's only going to have access 
to any "user login scope" variables. On Windows, this is anything in the 
Environment tab (you need to restart Creator to pick up changes). On Mac 
OS it's stuff from a .plist file (you need to log off and on to pick up 
changes). On Linux it's ~/.profile (you need to log off and on to pick 
up changes).

If you start Creator from a console, then the variables set in that 
console should also have an effect.

You can see what environment Creator is using on the Projects tab, in 
the Build Environment area. You can add custom environment variables 
here but they will be visible to that build only. Make sure you have not 
checked the box to clear the system environment.


-- 
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/



More information about the Qt-creator mailing list