Author Topic: Adding a path to PATH variable per project  (Read 5717 times)

Offline effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Adding a path to PATH variable per project
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Adding a path to PATH variable per project
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Adding a path to PATH variable per project
« Reply #2 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?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Adding a path to PATH variable per project
« Reply #3 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline effemmeffe

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: Adding a path to PATH variable per project
« Reply #4 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.