[CMake] cmake, eclipse, and multiple projects

Dan Kegel dank at kegel.com
Thu Oct 20 18:21:42 EDT 2011


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.
Since the Eclipse users want to see one of those pairs per
artifact, with nice dependencies between the projects, that's not going to fly.

Or am I wrong, and does cmake somehow allow representing
a bunch of interlinked projects that know how to invoke each other,
as Eclipse likes?

Thanks,
Dan

[rant 1]
So they don't notice how horribly complicated it is to set up Eclipse
(about a dozen clicks and words typed per artifact to get it from Subclipse,
times the number of artifacts), since It's The Air They Breathe,
they like it that way. Worse, Eclipse is a jealous god, and its
SVN and GIT plugins really, really don't want to refer to outside source
trees created by commandline svn or git; they want to own the source
tree entirely.  (Eclipse users never notice this because they live
entirely in the IDE.)
That means that you can't easily automate setting up a development
environment that refers to multiple artifacts... every damn user has to go
clicky clicky clicky a dozen times to get the source tree for each of
the artifacts.


More information about the CMake mailing list