默认设置为'gcc'。但是说我的编译器名称是'my_gcc',链接器'my_gcc'和assember是'my_as。
你是如何用模板设置的?
我会认为您会执行以下操作:
<process type="org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue">
<simple name="projectName" value="$(projectName)" />
<complex-array name="resourcePaths">
<element>
<simple name="id" value="cdt.managedbuild.tool.gnu.cross.c.compiler" />
<simple name="value" value="my_gcc" />
<simple name="path" value="" />
</element>
</complex-array>
</process>
我需要在别处设置这些属性吗?
答案 0 :(得分:0)
无法找到基于模板的解决方案;但这是一个程序化的解决方案:
//assumptions
//#1 project is [0] in workspace
//#2 compiler is [2] in workspace
//get project
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject("hello_world");
//get <storageModule moduleId="org.eclipse.cdt.core.settings">
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj);
//get <storageModule moduleId="cdtBuildSystem">
IManagedProject sub_info = info.getManagedProject();
//get <configuration name="Debug">
IConfiguration config = sub_info.getConfigurations()[0];
//get <toolChain>
IToolChain toolchain = config.getToolChain();
//get <tool name="GCC C Compiler">
ITool tool = toolchain.getTools()[2];
//-----update command----//
ManagedBuildManager.setToolCommand(config, tool, "my_gcc");
ManagedBuildManager.saveBuildInfo(proj, true);
然后只需重复您需要修改的每个工具。