Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to set include paths programmatically?

Hi,
 
I use ManagedBuildManager.setOption(config,tool,option,value) method to set libraries and library search path option of linker. and it calls configuration.setOption().
Then it libs and lib paths are changed in the projects Properties->ToolSettings page but they aren't saced to the .cproject file. When I closed and reopen Eclipse CDT libs and paths are disappeared from the properties page.
I looked at the setOption() method of ToolSettingsTab class and it also use ManagedBuildManager.setOption and that's all changed options are set in .cproject.
Does  anybody can help me what should I do to set libs options in .cproject?

--- On Thu, 2/25/10, Dmitry Kozlov <ddk@xxxxxxxxxxxxxxxx> wrote:

From: Dmitry Kozlov <ddk@xxxxxxxxxxxxxxxx>
Subject: Re: [cdt-dev] How to set include paths programmatically?
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Date: Thursday, February 25, 2010, 12:17 PM

Hi George,
Include path is a tool (compiler) option. You need too get tool's options, find one with appropriate name
and call configuration.setOption(tool, option, value):

for (ITool t : config.getToolChain().getTools() ) {
                   if ( t.getId().contains("c.compiler") ) {
                       IOption o = t.getOptionById("gnu.c.compiler.option.include.paths");
... // setup paths ArrayList
                       config.setOption(t, o, paths.toArray(new String[]{}));
}




George Russell wrote:
> Hi all,
>
> I am wondering how I can set the CDT's include paths either programmatically or in a configuration file?
>

> At the moment, the include lines of source files are reported as warnings in the CDT editor, and I'd like to avoid forcing users to set up paths manually when it can be automated or pre-set.
>
> Regards,
> George
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top