[CMake] Problem with generated source and header files

Marcel Loose loose at astron.nl
Thu Jul 2 03:57:12 EDT 2009


Hi James,

On Wednesday 01 July 2009 15:58:12 James C. Sutherland wrote:
> > So, in general, when using globbing, YOU are responsible for rerunning
> > CMake whenever you've added a source file. Otherwise you run the
> > risk of
> > the new file not being compiled. Furthermore, you might accidentally
> > compile sources that were just lying around in your directory as test
> > code. Deletion of sources can also cause interesting effects if you
> > create a library, because the object will remain in that library until
> > you (manually) remove and recreate the library.
> >
> > I hope my examples convinced you enough that globbing is (in
> > general) a
> > bad idea.
>
> So is it common practice among users of CMake to manually create and
> maintain a list of all files that are to be compiled, even if such a
> list is very large and may involve several directories and
> subdirectories?

I can't talk for others, but I think it's more the rule than the exception. 
But no-one forbids you to use globbing. It's just that you should be aware of 
the consequences; things can go wrong in very subtle ways.

Anyway, IMHO, the effort of keeping a list of source files up-to-date is much 
less than writing the content of these sources files. 

Just my 2 cents.

Regards,
Marcel Loose


More information about the CMake mailing list