[cmake-developers] Safe source list GLOBs

Alexander Neundorf neundorf at kde.org
Mon May 20 06:04:54 EDT 2013


On Monday 20 May 2013, Wojciech Knapik wrote:
> On Wed, May 15, 2013 at 07:26:58PM +0200, Alexander Neundorf wrote:
> > On Wednesday 15 May 2013, Bill Hoffman wrote:
> > > On 5/15/2013 4:48 AM, Wojciech Knapik wrote:
> > > > On Tue, May 14, 2013 at 03:55:37PM -0400, Bill Hoffman wrote:
> > > >> Globs simply do not work well for source files.
> > > > 
> > > > GLOBs work great for source files. Just not with CMake currently ;]
> 
> *SNIP*
> 
> > > I don't see what the big deal is.   You run glob once from a shell or
> > > editor and you get the initial list of files.   From that point on the
> > > effort to add/remove a new file to the list is trivial.
> > 
> > I agree, this is really only an issue at all when creating the
> > CMakeLists.txt initially.
> 
> It's only an issue when creating the CMakeLists.txt initially if you
> choose to use GLOBs for source lists.
> 
> If you choose to use explicit file lists instead, you need to actively
> maintain the CMakeList forever.


Yes. Typically this means adding or removing one line containing the name of a 
source file from time to time, this is really not much work. You create a new 
source file, edit it, and add its name to the CMakeLists.txt to get it 
compiled. If you don't want to compile it yet, don't add it yet.

I haven't heard anybody complaining about this in the last years.
It is typically really only when setting up cmake for an already existing 
project.

Alex



More information about the cmake-developers mailing list