Eclipse CDT4 Generator: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
==Eclipse CDT 4.0 Generator== | ==Eclipse CDT 4.0 Generator== | ||
[[Image:CMakeEclipseCDT4_TSPBuild.png|thumb|right|350px|CMake generated Eclipse Project for TSP]] | <!-- [[Image:CMakeEclipseCDT4_TSPBuild.png|thumb|right|350px|CMake generated Eclipse Project for TSP]] --> | ||
[[Image:CMakeEclipseCDT4GeneratorScreendump.png|thumb|right|350px|Eclipse opens CMake project file]] | [[Image:CMakeEclipseCDT4GeneratorScreendump.png|thumb|right|350px|Eclipse opens CMake project file]] | ||
Starting with version 2.6.0 CMake includes an Eclipse CDT 4.0 generator (not released yet, but already in cvs). It works together with the Makefile generators available now (i.e. "Unix Makefiles", "MinGW Makefiles", "MSYS Makefiles", and maybe "NMake Makefiles"). | |||
With this generator it is possible to create a set of .project/.cproject files that can be imported in Eclipse as an "Existing Eclipse project". | With this generator it is possible to create a set of .project/.cproject files that can be imported in Eclipse as an "Existing Eclipse project". | ||
Note that CMake 2.4.x users may follow instructions provided here [[CMake:Eclipse]] in order to setup an Eclipse+CMake usage ''manually''. | |||
==Using Eclipse CDT4 Generator== | ==Using Eclipse CDT4 Generator== | ||
Using the Eclipse CDT4 generator is not different as using another CMake generator. | |||
Using the Eclipse CDT4 generator is not different as using another CMake generator, it works for in-source and out-of-source builds. | |||
In this example I assume the source tree of my project | In this example I assume the source tree of my project | ||
is ''/home/eric/certi_src'' | is ''/home/eric/certi_src'' | ||
Line 30: | Line 24: | ||
<li> Launch CMake | <li> Launch CMake | ||
<pre>cmake -G"Eclipse CDT4 - Unix Makefiles" ../certi_src</pre> | <pre>cmake -G"Eclipse CDT4 - Unix Makefiles" ../certi_src</pre> | ||
After that you will find two | After that you will find two Eclipse file in your build tree: | ||
<ol> | <ol> | ||
<li> <tt>certi_build/.project</tt></li> | <li> <tt>certi_build/.project</tt></li> | ||
Line 48: | Line 42: | ||
[[Image:Capture-Import.jpg|thumb|center|200px|Eclipse Import after build tree selection]]</li> | [[Image:Capture-Import.jpg|thumb|center|200px|Eclipse Import after build tree selection]]</li> | ||
<li> You get a fully | <li> You get a fully functional eclipse project | ||
[[Image:Capture-certi_build-Eclipse.jpg|thumb|center|200px|Eclipse Imported CERTI project]]</li> | [[Image:Capture-certi_build-Eclipse.jpg|thumb|center|200px|Eclipse Imported CERTI project]]</li> | ||
</ol> | </ol> | ||
Line 54: | Line 48: | ||
</ol> | </ol> | ||
==Using Eclipse CDT4 Generator | ==Using Eclipse CDT4 Generator with version control systems== | ||
There is a limitation of the CMake CDT4 Eclipse generator when | There is a limitation of the CMake CDT4 Eclipse generator when | ||
your source tree is handled by a versioning system (like CVS, Subversion or other) | your source tree is handled by a versioning system (like CVS, Subversion or other) you may read the referred discussions in the links below. | ||
you may read the referred discussions in the links below. | |||
A | A maybe acceptable ''solution'' is to have 2 projects: | ||
<ol> | <ol> | ||
<li> one for version management | <li> one for version management | ||
This one may be obtained by a normal ''checkout'' using new project from CVS</li> | This one may be obtained by a normal ''checkout'' using new project from CVS</li> | ||
<li> one | <li> one for building, resulting from the imported CMake generated project which | ||
is obtained by the previously described procedure</li> | is obtained by the previously described procedure</li> | ||
</ol> | </ol> | ||
Line 73: | Line 66: | ||
==Discussion about Eclipse CDT4 Generator limitations== | ==Discussion about Eclipse CDT4 Generator limitations== | ||
Eclipse | If you would like to monitor the changes to the EclipseCDT4 support, you can view the following links which contain the cvs history log for changes to the two main files: | ||
* [http://www.cmake.org/cgi-bin/viewcvs.cgi/Source/cmExtraEclipseCDT4Generator.h?root=CMake&view=log cmExtraEclipseCDT4Generator.h] | |||
* [http://www.cmake.org/cgi-bin/viewcvs.cgi/Source/cmExtraEclipseCDT4Generator.cxx?root=CMake&view=log cmExtraEclipseCDT4Generator.cxx] | |||
Eclipse assumes project files (i.e. .project and .cproject) ''must | |||
be at the root of the project tree'' '''and''' a project | be at the root of the project tree'' '''and''' a project | ||
may be handled by a versioning system (CVS, SVN, ...) iff | may be handled by a versioning system (CVS, SVN, ...) iff | ||
Line 82: | Line 81: | ||
by a versioning system) reside ''in the source tree''. | by a versioning system) reside ''in the source tree''. | ||
There has been a fair amount of discussion regarding this | There has been a fair amount of discussion regarding this problem | ||
of the Eclipse CDT4 Generator: | of the Eclipse CDT4 Generator: | ||
<ol> | <ol> |
Revision as of 21:09, 29 October 2007
Eclipse CDT 4.0 Generator
Starting with version 2.6.0 CMake includes an Eclipse CDT 4.0 generator (not released yet, but already in cvs). It works together with the Makefile generators available now (i.e. "Unix Makefiles", "MinGW Makefiles", "MSYS Makefiles", and maybe "NMake Makefiles"). With this generator it is possible to create a set of .project/.cproject files that can be imported in Eclipse as an "Existing Eclipse project".
Note that CMake 2.4.x users may follow instructions provided here CMake:Eclipse in order to setup an Eclipse+CMake usage manually.
Using Eclipse CDT4 Generator
Using the Eclipse CDT4 generator is not different as using another CMake generator, it works for in-source and out-of-source builds. In this example I assume the source tree of my project is /home/eric/certi_src
- Create a build directory and goes there
mkdir /home/eric/certi_build cd /home/eric/certi_build
- Launch CMake
cmake -G"Eclipse CDT4 - Unix Makefiles" ../certi_src
After that you will find two Eclipse file in your build tree:
- certi_build/.project
- certi_build/.cproject
- Import the created project file into Eclipse:
- Launch eclipse
- Import project using Menu File->Import
- Select Existing projects into workspace:
- Browse where your build tree is and select the root build tree directory
- You get a fully functional eclipse project
Using Eclipse CDT4 Generator with version control systems
There is a limitation of the CMake CDT4 Eclipse generator when your source tree is handled by a versioning system (like CVS, Subversion or other) you may read the referred discussions in the links below.
A maybe acceptable solution is to have 2 projects:
- one for version management This one may be obtained by a normal checkout using new project from CVS
- one for building, resulting from the imported CMake generated project which is obtained by the previously described procedure
You will find a screen cast describing how to it here: File:CMakeEclipseCDT4andCVS-2.ogg
Discussion about Eclipse CDT4 Generator limitations
If you would like to monitor the changes to the EclipseCDT4 support, you can view the following links which contain the cvs history log for changes to the two main files:
Eclipse assumes project files (i.e. .project and .cproject) must
be at the root of the project tree and a project
may be handled by a versioning system (CVS, SVN, ...) iff
the root project tree is.
This assumption clashes with the fact that CMake generated files should stay in the build tree whereas source files (which are usually those handled by a versioning system) reside in the source tree.
There has been a fair amount of discussion regarding this problem of the Eclipse CDT4 Generator:
- Trouble with CMake + Eclipse + SVN/CVS
- *Updated* Eclipse CDT4 CMake Generator - Pre-Alpha version
- Partially Shared project using Eclipse CDT (cdt-dev ML)