Hi,
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 {
@Override
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?
Thanks,
Anton.