[CMake] Executable depending on all source files

Eric Noulard eric.noulard at gmail.com
Sat Aug 25 09:19:59 EDT 2012


2012/8/25 Russell Wallace <russell.wallace at gmail.com>:
> I don't understand what you mean, but explicit listing violates DRY in
> a big way with the usual consequence, the two lists will inevitably
> get out of sync. I'd rather use globbing (unless CMake has some other
> method that doesn't involve trying to keep things in sync by hand)?
> Even plain Make can use globbing reliably.

Besides the argument of tracking changes, portability comes in mind as well.
Does XCode, Visual Studio, Eclipse (with managed Makefile)
etc... do handle globbing as well ?

CMake should be able to generate project files for all these build
system so that relying on the fact that Make may handle globbing is not enough
for making it work for CMake.

Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ?
Probably not and for good reasons, the same rule apply for CMake.

What you 'could do' is to craft some scripts (CMake or else) that
may automagically update the extensive list of sources in your CMakeLists.txt.
This script may be launched by a CMake custom target of yours, e.g.
then you'll be able to do

make up_src_list

instead of editing the CMakeLists.txt manually,
that said I doubt it would be  worth the effort.

My point of view is that globbing for source is seldom useful unless
the sources files are generated.

My opinion though.
-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list