views:

137

answers:

1

We are using CMake to manage our builds and have a rather large project consisting of pretty much everything that is needed to build the software base for our embedded platforms save for the toolchain. When building a CDT project with CMake it puts everything into one large project rather than splitting it into individual projects based on the CMake specification.

Our problem is that we have both C and C++ code in the project and we have different code styles for these languages. I have not been able to find out how to tell Eclipse to select a code style based on the file type rather than the project and this makes it very hard to use Eclipse for us since you have to remember to manually switch the style for the entire project if you want to switch from working on a C- to a C++-project or vice versa.

Is it at all possible to set the code style based on the file type rather than just for an entire project?

+1  A: 

You can make use of the "link to folder in the file system" advanced option of the new folder dialog box.

Basically create a project build-c, and then create a new folder inside there called build and link to the build source files located elsewhere. Then for the build-c project you can change the code style to something else than the build project.

If this gets confusing, you can create another project called build-cpp and do the same thing (create a folder called build and link to the actual location of the build source files). Then you can make use of filtering projects by working sets (one working set including the build-c project, and another working set called build-cpp).

Since the folders in both projects just link to the original location of the build files you don't have to worry about multiple copies between projects. You would still only be able to check files in from the main build project however. It also still requires the user to manual switch working sets from c to cpp depending on what they're interested in changing.

apekarske