News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Adding a path to PATH variable per project

Started by effemmeffe, August 31, 2012, 04:30:56 PM

Previous topic - Next topic

effemmeffe

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

MortenMacFly

Quote from: effemmeffe on August 31, 2012, 04:30:56 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

effemmeffe

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?

MortenMacFly

Quote from: effemmeffe on September 03, 2012, 10:55:38 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

effemmeffe

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.