[CMake] Executable depending on all source files

Russell Wallace russell.wallace at gmail.com
Sat Aug 25 05:53:48 EDT 2012


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.

On Sat, Aug 25, 2012 at 10:41 AM, Alexander Neundorf
<a.neundorf-work at gmx.net> wrote:
> On Saturday 25 August 2012, Russell Wallace wrote:
>> How do you specify that an executable depends on all source files in a
>> directory? I've tried doing it like:
>>
>> add_executable(foo src/*.cc)
>>
>> but that only seems to pick up the first source file?
>
>
> Explicitely list all of them.
> Globbing is not good, cmake can't notice then when it has to rerun, and it may
> pick up stuff it shouldn't.
>
> Alex


More information about the CMake mailing list