Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting environment variables for build in Visual Studio (2008)

I looked at some projects generated by the Qt plugin for VS and noticed that they use the environment variable QTDIR to refer for example to the Qt header files. However I failed to figure out where this variable is set. I guess it must be somewhere in the project settings, however I could not find it. Also please note that I am referring to the environment variables required during the build, not the ones for debugging.

like image 225
Nils Avatar asked Feb 21 '23 06:02

Nils


1 Answers

On Windows there are two ways to set an environment variable like QTDIR: either permanently in System Properties->Advanced->Environment Variables or temporarily for a single cmd session by opening cmd.exe and executing set QTDIR=/path/to/qt; now when starting VS from that commandline (execute devenv.exe) it will use the QTDIR value just set. The second case you use mainly when you have multiple QT installations.

Apart from that, you can also use User Macros in VS Property sheets. From the build tools' point of view they are sort of equivalent to environment variables. Add a new property sheet to your project, double click on the new sheet, go to the User Macros page and click on Add Macro. Nice thing is you can share this property sheet amongst all your Qt projects.

like image 120
stijn Avatar answered Mar 05 '23 20:03

stijn