User forums > Using Code::Blocks

search directories using environment variables

(1/1)

rufeo:
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!

MortenMacFly:

--- Quote from: rufeo on March 13, 2007, 10:32:41 pm ---like $(CPPUNIT_INCLUDES) rather than "../../dependencies/CppUnit/include".  Thanks!

--- End quote ---
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.

rufeo:
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.

MortenMacFly:
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]

Navigation

[0] Message Index

Go to full version