Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Programmatically editing the build command for a makefile project

Greetings,
I'm working on a plugin that must automatically adjust the compiler commands used to build a project. This is pretty easy to do with a managed make project using the api but a project using a standard makefile needs some trickery. I'm assuming the makefile is using standard variable names for the compilers. When that is the case instead of using 

make 

I can build the project with 

make CC=<my_cc_compiler> CXX=<my_c++_compiler>
etc to substitute the compiler commands generated by the plugin. Editing the standard make command manually is pretty easy: under properties -> build in the builder settings tab uncheck "use default build command" and edit the "Build Command" field.

I need to know how to edit that field for a project from within a plugin. I have access to my IProject object. I tried using a IMakeBuilderInfo returned by MakeCorePlugin but the closest setter I could find was setBuildArguments which is deprecated and the suggested replacement, setBuildString, doesn't exist as far as I can tell. I get a null pointer exception when I try to use setBuildArguments so I'm sort of stuck at the moment. Any suggestions on where to look in the api would be much appreciated.

Thanks,
Wyatt Spear

Back to the top