Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Env variables and generated makefile(env variable access syntax different in eclipse and make)
Env variables and generated makefile [message #813597] Mon, 05 March 2012 08:37 Go to next message
Eclipse UserFriend
Hi,
I'm doing a project which is supposed to be multiplatform and developed by several developers. I'm using external libraries like boost and want automatic builds using eclipse-generated makefiles. Because everyone has the external libraries installed under different paths I've decided to tell eclipse where they are by env variables (like BOOST_ROOT) which everyone can setup on their machine. The include and library paths were put into eclipse (project properties->c/c++ build->settings).

Now the problem: eclipse sees the values of environment variables using the syntax ${ENV_VAR} but make uses $(ENV_VAR) -> different brackets. If I use the first syntax the internal builder and indexer works but make cannot read the paths so the build fails. If I use the second I can build the program with make but the indexer shows errors in half the program because of unresolved includes, finding references fails, the project becomes unworkable.

So my question is: am I doing something wrong? Is there any workaround for what I want to do? Or maybe the approach I'm using is wrong from the start and there is a different one?
Re: Env variables and generated makefile [message #827937 is a reply to message #813597] Fri, 23 March 2012 21:19 Go to previous message
Eclipse UserFriend
Hi All,

I'm trying to accomplish the same thing - have the generated makefile have "-I$MY_ENV_VAR" in the compile command. I find that when I add ${MY_ENV_VAR} or $(MY_ENV_VAR) in the Includes list of the C++ compiler settings under C++ Builder-> Settings, both the make and the indexer work.

But the problem is that the compile command and makefile have the *value* of MY_ENV_VAR in it, rather than the variable reference. This is true even though I have unchecked the "Expand Env. Var Refs in Makefiles" option in Properties->C++ Builder.

I also found that if I put "/$$MY_ENV_VAR" in the Includes list, the generated makefile has -I$$MY_ENV_VAR in it, which works when I run make from the Unix shell. But then the Eclipse indexer is confused. Catch 22...

I can't believe there's not a way to do this. Anyone know how? P.S. i'm using C/C++ Dev Tools version 8.0.2

Thanks
Alex

Previous Topic:How to add another toolchain
Next Topic:Stale Wrong errors when compiling Eclipse CDT
Goto Forum:
  


Current Time: Tue Jun 17 01:17:36 EDT 2025

Powered by FUDForum. Page generated in 0.05565 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top