Question

default setting is 'gcc'. but say my compiler's name is 'my_gcc', linker 'my_gcc' and assember is 'my_as.

how the heck do you set that with a template??

I would think you would do the following:

<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>

are these properties I need to set elsewhere??

Was it helpful?

Solution

couldn't find a template-based solution; but here is a programmatic solution:

//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);

then just repeat for each tool you need to modify.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top