It's not all that impressive or, really, very efficient.
- I get an xml file from our build system which contains the -I's and -D's. It has some other stuff, like module names and relative paths to modules, but these are all specific to us.
- I have a python script which reads a .project and a .cproject file using python's XML parsing module. It looks for attributes named "id" whose values match a given regular _expression_, and replaces the value with an xlst variable. The then looks for option elements whose valueType(?) attribute is "includePath", and replaces them with an <xsl:foreach> element. Finally, it wraps the whole thing in an <xsl:transform> node and dumps to files cproject.xsl and project.xsl. These are xslt transform programs.
- I have a shell script with futzes around with envariables to figure out where the xslt files are, where the sources are and where the workspace is, and then calls the unix program xsltproc to transform the file in bullet (1) to .cproject and .project files.
The whole think took me about two days. It would have taken less, but I didn't know anything about python's XML module or xslt. I had to read up on just enough of them to get what I needed. Someone competent could probably do the job in a few hours.
I'll see what I can do.