Eclipse CDT Project Template - Configuring Drop-Down Options

I am trying to create a new project template for the Eclipse CDT to answer my question asked here . @Jonah Graham provided a very detailed overview in her answer to 1 , and it delivered me most of the way.

However, I cannot figure out how to set the parameter that is listed in the drop-down list; for example Dialect / Language Standard on ISO C++11 (-std=c++01) on the "Settings / Tool Settings" / GCC C ++ Compiler / Dialect tab. The same problem would occur if I wanted to change the default optimization or debug levels, etc.

I thought maybe this could be achieved with something like

 <process type="org.eclipse.cdt.managedbuilder.core.SetMBSStringListOptionValues"> <simple name="projectName" value="$(projectName)" /> <complex-array name="resourcePaths"> <element> <simple name="id" value=".*cpp\.compiler\.option\.dialect\.std." /> <simple-array name="values"> <element value="gnu.cpp.compiler.dialect.c++11" /> </simple-array> <simple name="path" value="" /> </element> </complex-array> </process> 

Unfortunately, this has no effect (no errors, but nothing in the resulting .cproject file).

I can get around this by setting the โ€œOther dialectโ€ flag, which is just a string, but I would like to know how to do this using the drop-down list, as they appear elsewhere.

+2
source share
1 answer

The way to do this option is to consider it as a string and internals with changing the value of the string to the value of the enumeration. I tested it with C99 (i.e. not C ++), for which I used this:

 <!-- Set -std=c99 by selecting the enum in the settings --> <process type="org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue"> <simple name="projectName" value="$(projectName)" /> <complex-array name="resourcePaths"> <element> <simple name="id" value=".*compiler\.option\.dialect\.std.*" /> <simple name="value" value="ISO C99 (-std=c99)" /> <simple name="path" value="" /> </element> </complex-array> </process> 

So, for your decision, I expect this to work. Note that the value is what the user displays:

 <process type="org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue"> <simple name="projectName" value="$(projectName)" /> <complex-array name="resourcePaths"> <element> <simple name="id" value=".*cpp\.compiler\.option\.dialect\.std." /> <simple name="value" value="gnu.cpp.compiler.dialect.c++11" /> <simple name="path" value="" /> </element> </complex-array> </process> 

Compared to your version, I changed the type of the process and the whole element name="value" (from simple-array to simple plus the internal name to display the name).

+3
source

Source: https://habr.com/ru/post/1233572/


All Articles