Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » How to set environment variables from a script ?
How to set environment variables from a script ? [message #674014] Wed, 25 May 2011 10:17 Go to next message
Eclipse UserFriend
Hi all,

We have an IDE based on Eclipse/CDT for our toolchains. Most of our users use some Makefile projects and the makefiles contain a lot of environment variables. And they are frequently have to change some environment variables to build the project for a specific target.

For now, what they do:
- execute a script .sh from a shell to properly set the environment
- launch Eclipse
- build the project
And each time, they need a build for a new target:
- exit Eclipse
- repeat the previous steps

It is not user friendly Sad

Now, what we would like is:
- from Eclipse, being able to execute the script commands (.bat, .sh) and apply the environment to project build
- Ideally,
- associate it with a build configuration
- displaying the environment variables in the "C/++ > Environment" dialog.

Is it already possible with existing CDT features ? Has someone already experienced something similar and could share it ?

Thanks by advance
Jerome


Re: How to set environment variables from a script ? [message #674205 is a reply to message #674014] Thu, 26 May 2011 02:49 Go to previous messageGo to next message
Eclipse UserFriend
You can define a build configuration for each target that needs different environment variables. For each build configuration you can define its own environment (see Project Properties->C/C++ Build->Environment).

Alternatively, you can add a new builder to your project that calls your shell script in advance. (Project Properties->Builder)
Re: How to set environment variables from a script ? [message #674609 is a reply to message #674205] Fri, 27 May 2011 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Potentially, for our kind of C/C++ project, there are many environment variables that could be changed by end-users (more than 100). So populating build configurations for each target would be a pain for end-users Sad

The same with a new Builder because we don't know by advance the script content/location etc.

What I had in mind is: to add a button "set env" in the C/C++ Build > Environment (below the Add/Remove/etc.). This button opens a dialog to through this button browse until a script command file, and potentially some arguments to pass to this script. When closing this dialog, the script results would populate the table of variables (i.e. "environment variables to set").

When the end-user would like to change his environment, he would only have to click on this button and select another script.

Do you have any opinion on that feature ? Has someone already do something similar ?

Jerome


Re: How to set environment variables from a script ? [message #684746 is a reply to message #674609] Thu, 16 June 2011 03:05 Go to previous message
Eclipse UserFriend
You are not the only one.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349455
Previous Topic:How to call existing C functions in executable file during debug session?
Next Topic:Starting with eclipse
Goto Forum:
  


Current Time: Sat Jul 12 09:53:47 EDT 2025

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

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

Back to the top