Author Topic: search directories using environment variables  (Read 5028 times)

rufeo

  • Guest
search directories using environment variables
« on: March 13, 2007, 10:32:41 pm »
I would like the change the search directories in my codeblocks project file, but I want them to use environment variables rather than a path defined by the project creator.  The FAQ has a topic about setting the search directories on projects, but it does not say how to use environment variables on projects in place of that path.  How can I do this?  In MSVC, the format is $(MY_VARIABLE).  So, I would like to be able to open the search directories section of my project and see environment variables in place of the paths to the dependency folders, like $(CPPUNIT_INCLUDES) rather than "../../dependencies/CppUnit/include".  Thanks!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: search directories using environment variables
« Reply #1 on: March 13, 2007, 10:45:25 pm »
like $(CPPUNIT_INCLUDES) rather than "../../dependencies/CppUnit/include".  Thanks!
Why don't you just do it? The syntax is exactly like that. ;-) BTW: More advanced and with improved usability are global variables. They are being used with a "#" (sharp) instead of "$". Look in the WiKi here: http://wiki.codeblocks.org/index.php?title=Global_compiler_variables
With regards, Morten.
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

rufeo

  • Guest
Re: search directories using environment variables
« Reply #2 on: March 13, 2007, 11:08:06 pm »
Oh I tried this, trust me, it doesn't work for me.  In a shell, I can type:
> ls $(CPPUNIT_INCLUDES)

and it prints out the right header files, but in Codeblocks, using that syntax does not let my program compile.  I am using build SVN 3652.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: search directories using environment variables
« Reply #3 on: March 14, 2007, 08:01:22 am »
Well I just tried (r3693) and it *works* here. I have attached an image that shows where I setup things. I have used the Temp variable that is available on every system (type "set" or "env" at a command prompt to see). As the image shows this gets expanded to my Temp directory and is added as (sense-less) include folder to the compiler options. On linux you may have to "backtick" this expression but I doubt this is really required...?!
With regards, Morten.

[attachment deleted by admin]
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