[CMake] multiple cmake files in one directory
Tyler Roscoe
tyler at cryptio.net
Wed Sep 23 11:48:01 EDT 2009
On Wed, Sep 23, 2009 at 11:08:38AM +0200, Jeroen Dierckx wrote:
> 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.
The overhead is only less until a developer wastes an hour or two trying
to track down why his new source file isn't being compiled.
It's a Best Practice for a reason. If you aren't following it, I'm sure
you have terrific reasons and that you know exactly what you're doing...
just like everyone else who decides to go against a Best Practice :).
good luck,
tyler
More information about the CMake
mailing list