Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Build variables in CDT

There is an old How different is what you are doing from what was requested in


On Fri, Mar 30, 2012 at 3:31 AM, xgsa <xgsa@xxxxxxxxx> wrote:

As nobody answered on my suggestions in previous mail I decided to provide the patches implementing them. I haven't file the bugs yet just because I am not sure that these suggestions will be accepted by the community. If they are I'll do it.

The "cdt_vars_in_capplication_path.patch" implements variables substitution for "C/C++ Application" field in Launch Configuration dialog. It also adds the "Variables..." buttons for the Main tab (actually they are two different patches merged in one to be logically completed, however I can provide them separately if necessary).

The "cdt_build_variables.patch" implements a few Eclipse variables "cdt_config_name" and "cdt_config_description" which return the CDT active configuration name/description for the project specified as an argument.

Please let me know whether such suggestions (and solutions) are accepteble and if they are I'll file the bugs and we'll discuss the details there.


-------- Original message --------

Recently I investigated how the CDT build variables work in different places. I discovered the following:
  • in Launch Configuration dialog only Eclipse Platform variables work and only in "Arguments" and "Working directory" fields, but not in "C/C++ Application".
  • in project properties --> "C/C++ Build" and "Paths and Symbols" there are also a lot of useful variables (ConfigName, ConfigDescription, CDTVersion and others).
  • in "Modify Make Target" dialog the Eclipse and CDT variables work fine, however there is no "Variables..." button.
Probably there are also other places where variables are substituted, but I want to discuss these ones.

Firstly, I am wondering why variable substitution does not work for "C/C++ Application". It seems it is easy to implement the necessary functionality similarly to the "Working directory". If it was not implemented just because nobody need it and there is no objections I can file a bug and provide a patch.

Secondly, I cannot understand why CDT variables are implemented via the own manager, but not as Eclipse Platform variables. I also found the bug 180256 ("Launch configurations should support build variables") in which Doug describes the problem with platform variables extension. However I cannot see the problem. I tried to implement ConfigName as a Platform variable like this:
public class MyCDTVersion implements IDynamicVariableResolver {
    public String resolveValue(IDynamicVariable variable, String argument) throws CoreException {
        IDynamicVariable projectName = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable("project_name");
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName.getValue(null));
        ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(project);
        return projectDescription.getActiveConfiguration().getName();
And it works fine. It seems that other variables can also be implemented. So is that comment actual for now? I want to have at least ConfigName and ConfigDescription to use them in Launch Configuration Dialog. I can provide a patch for that.

An the last one, probably "Modify Make Target" dialog should be updated. I cannot find the corresponding bug. Did I miss it or should I create a new one?

_______________________________________________ cdt-dev mailing list cdt-dev@xxxxxxxxxxx

cdt-dev mailing list

Back to the top