How to differentiate between build configurations in Eclipse (C) project template to setup build cfg sepcific settings?

喜夏-厌秋 提交于 2019-12-12 03:26:00

问题


I'm trying to play with Eclipse (C) project template. I found this very descriptive answer of how to work with Eclipse project template from @Jonah Graham and went through Eclipse documentation - How to add project templates to CDT

I'm able to create the project template and setup some settings by "SetMBSStringOptionValue"

<!--  Set TMP setting by adding textual build 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\.misc\.other*" />
            <simple name="value" value="TMP_SETTING_RELEASE" />
            <simple name="path" value="" />
        </element>
    </complex-array>
</process>

My question is how do I differentiate between build configurations? E.g. I want to setup different settings for "Debug" and "Release" build configuration. How should I do that?


回答1:


AFAIK no one has provided a "process runner" that allows the configuration to be specified when setting the options.

What you can do is add your own subclass of org.eclipse.cdt.core.templateengine.process.ProcessRunner, basing it on org.eclipse.cdt.managedbuilder.core.SetMBSStringOptionValue that additionally lets you specify the configuration to apply it to. The Eclipse extension point you need is org.eclipse.cdt.core.templateProcessTypes.

Keep in mind when you do that users do a new project wizard they can choose to have/not have Debug/Release configs as shown in this screenshot:



来源:https://stackoverflow.com/questions/45232211/how-to-differentiate-between-build-configurations-in-eclipse-c-project-templat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!