[CMake] cmake, eclipse, and multiple projects

Alexander Neundorf a.neundorf-work at gmx.net
Fri Oct 21 13:02:04 EDT 2011


On Friday 21 October 2011, Dan Kegel wrote:
> Where I work, a lot of people use Eclipse, a few people use Xcode,
> a few people use Visual Studio, and a few people use vi and the
> commandline. (I'm in the latter camp, and have only moderate familiarity
> with IDEs.) Each camp seems to have a different way of building the same
> code. Naturally, the thought of unifying build systems with cmake
> was attractive, so I picked up cmake and got one little corner of the
> world building with it.
> 
> The project is structured as several artifacts (executables and shared
> libraries),
> each with its own versioned subversion tree.  This seemed odd to me
> until I realized it's probably the way Eclipse users think: each
> artifact's source should be its own project, with its own little
> repository.  [See rant 1]
> 
> Initially, I had a separate CMakeLists.txt for each artifact,
> and used find_package() to locate the other artifacts needed to build
> the current one.
> But that left me with no overall way to build the whole project
> from the commandline, so I switched to having an outer CMakeList.txt
> that included all the others.  That works great... until you think
> about how the Eclipse users are going to use it.
> 
> Now, I haven't tried generating an Eclipse project from cmake yet,
> but I suspect it's going to generate a single .project/.cproject pair
> no matter how many executables and shared libraries it builds.

Yes.
With 2.8.6, in the "Makefile targets" tab you get clickable items for each 
target (executable, library, etc.), so there they can build just what they 
want.
In 2.8.7, there will be additionally a "Targets" virtual folder, which will 
have a flat list of all targets, and under each targets its source files.
This should make for easier editing.

On the cmake-developers list there was recently somebody working on generating 
multiple .project/.cproject files. 
But I didn't here from hin again since May now already. IIRC his work required 
an additional plugin for Eclipse, to be able to import multiple projects at 
once.
If you're interested, you can have a look. (it was in april, subject "Better 
Eclipse CDT support"):
http://www.cmake.org/pipermail/cmake-developers/2011-April/thread.html
http://www.cmake.org/pipermail/cmake-developers/2011-May/thread.html


Alex


More information about the CMake mailing list