[CMake] multiple cmake files in one directory

Jeroen Dierckx jeroen.dierckx at gmail.com
Wed Sep 23 05:08:38 EDT 2009


2009/9/22 Tyler Roscoe <tyler at cryptio.net>:
> On Tue, Sep 22, 2009 at 08:34:36PM +0200, Jeroen Dierckx wrote:
>> What we do in our build system is using file(GLOB to get all .cmake
>> files in a "targets" directory, and including those. That way, to add
>> additional targets, all the developers have to do is add a .cmake file
>> to that directory.
>
> This is not a recommended practice. If you do it this way, CMake can't
> notice if new lists files have been created (or removed) and thus cannot
> trigger a rebuild of the CMake binary tree when it should.

I agree that this shouldn't be recommended in general, but in our
specific build environment the developers know that they have to run
cmake when they add targets (or even source files, because adding
those are automated too).
The overhead of having to run cmake themselves is a lot less than the
work they would have to do edit a main CMakeLists.txt file and
managing conflicts therein. Most of the time, some options for the new
targets have to be set in cmake anyway.

Greetz,
JeDi


More information about the CMake mailing list