Code::Blocks Forums

User forums => Help => Topic started by: effemmeffe on August 31, 2012, 04:30:56 pm

Title: Adding a path to PATH variable per project
Post by: effemmeffe on August 31, 2012, 04:30:56 pm
I'd like to modify the windows global variable PATH on a per project basis.
So when I compile a project I can have a modified PATH variable.
I can't figure out how to do that, can someone help me, please?
TIA
Title: Re: Adding a path to PATH variable per project
Post by: MortenMacFly on August 31, 2012, 05:50:50 pm
I can't figure out how to do that, can someone help me, please?
Use the EnvVars plugin, it has per-project specific options.
Title: Re: Adding a path to PATH variable per project
Post by: effemmeffe on September 03, 2012, 10:55:38 am
Thanks.
I tried, but I can't get it work and I can't figure out what I'm doing wrong...

I have a windows machine and I'm trying to compile a GTK+ program.
My GTK+ is installed in c:\programmi\gtk+ and I'd like to add that path to the global path so I can use pkg-config to add the needed libraries for my project.

In C::B settings->environment->environment variables I set up a new envvar set called gtk in which I put the line:
PATH = %PATH%;c:\programmi\gtk+\bin

Then in the Envvars options of my project I select the set I just created.

To test I wrote a simple batch file containing just the command PATH and I run it as pre-build step in my project build option.
Now in the build log I have the output of the windows command PATH and I can't see the added path c:\programmi\gtk+\bin.

Where is my mistake?
Title: Re: Adding a path to PATH variable per project
Post by: MortenMacFly on September 03, 2012, 11:10:05 am
Where is my mistake?
Enable the debug option in the envvar plugin, then run C::B with the "--debug-log" flag and see what happens for yourself in the debug log. I'll try myself once I find the time...
Title: Re: Adding a path to PATH variable per project
Post by: effemmeffe on September 03, 2012, 11:22:14 am
It worked!
To do what you suggested I had to close C::B and restart it via command line.
Once I restarted C::B I didn't have to change anything, I tried to recompile and now the PATH is correct.