I have a legacy, in-house tool that creates an Eclipse CDT project out of all the C files that I use to run Simulink simulations. I use the eclipse project as front end to G
.cproject
files aren't really designed to be generated by external tools. Their exact format is not documented, and is considered to be an implementation detail.
Extensibility and automation in the Eclipse ecosystem is intended to happen through Eclipse plugins. Eclipse plugins have access to a set of stable, documented APIs which can be used to manipulate an Eclipse workspace. For example, for creating a project you might use APIs like IWorkspaceRoot.getProject(), IProject.create(), and CoreModel.create(IProject). The implementation of these APIs will take care of details such as creating the .cproject
file.
If you really want to generate the .cproject
file yourself, your best bet is to refer to the CDT source code for details about its exact format, and ask any clarifying questions on the CDT mailing list. It may also be helpful to look at the source code of other cross-platform tools that create .cproject
files, such as CMake which has an Eclipse project generator.