[CMake] Executable depending on all source files

2012-08-25 Thread Russell Wallace
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? -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/openso

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Alexander Neundorf
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

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Russell Wallace
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 us

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Kornel Benko
Am Samstag, 25. August 2012 um 10:53:48, schrieb Russell Wallace > 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 doe

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Russell Wallace
On Sat, Aug 25, 2012 at 10:59 AM, Kornel Benko wrote: > The you may want to try > > file(GLOB foo_sources . src/*.cc) > > add_executable(foo ${foo_sources}) That works, thanks! -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensourc

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Alexander Neundorf
On Saturday 25 August 2012, Russell Wallace wrote: > 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. Yes, but here this is good IMO, since in general a file laying around in some direct

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Kornel Benko
Am Samstag, 25. August 2012 um 12:04:21, schrieb Alexander Neundorf > On Saturday 25 August 2012, Russell Wallace wrote: > > 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. > > Yes

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Rolf Eike Beer
Kornel Benko wrote: > Am Samstag, 25. August 2012 um 10:53:48, schrieb Russell Wallace > > > 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

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Eric Noulard
2012/8/25 Russell Wallace : > 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 s

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Russell Wallace
On Sat, Aug 25, 2012 at 2:19 PM, Eric Noulard wrote: > Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ? Git. And yes, of course it does. > What you 'could do' is to craft some scripts (CMake or else) that > may automagically update the extensive list of sources in your C

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Eric Noulard
2012/8/25 Russell Wallace : > On Sat, Aug 25, 2012 at 2:19 PM, Eric Noulard wrote: >> Does your VCS (git, cvs, svn,...) do globbing for adding/removing files ? > > Git. And yes, of course it does. No sorry, I wasn't clear enough unless I'm wrong you can do: git add blah*.c but : 1) If you ad

Re: [CMake] Executable depending on all source files

2012-08-25 Thread Russell Wallace
No, you can type e.g. 'git add .' to add all newly created files to the repository. It is true that you do have to prompt git to do that, it won't go off looking for new files on its own initiative. And I'm not expecting cmake to go off looking for new files on its own initiative either; as anothe

Re: [CMake] Executable depending on all source files

2012-08-26 Thread Eric Noulard
2012/8/25 Russell Wallace : > No, you can type e.g. 'git add .' to add all newly created files to > the repository. Yes I know but git handling is "binary" either a file is handled by git or not. With CMake a source could be - to be added to some add_library (1 or several) - to be added to so

Re: [CMake] Executable depending on all source files

2012-08-26 Thread Russell Wallace
On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard wrote: > Like I said even if the new file is a "cpp" file, should CMake add > it to add_executable or add_library or... If different C++ source files have different purposes, I would put them in different directories. > I know that you want to specif

Re: [CMake] Executable depending on all source files

2012-08-26 Thread Eric Noulard
2012/8/26 Russell Wallace : > On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard wrote: >> Like I said even if the new file is a "cpp" file, should CMake add >> it to add_executable or add_library or... > > If different C++ source files have different purposes, I would put > them in different directori

Re: [CMake] Executable depending on all source files

2012-08-26 Thread Rolf Eike Beer
Russell Wallace wrote: > On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard wrote: > > Like I said even if the new file is a "cpp" file, should CMake add > > it to add_executable or add_library or... > > If different C++ source files have different purposes, I would put > them in different directorie

Re: [CMake] Executable depending on all source files

2012-08-26 Thread Alexander Neundorf
On Sunday 26 August 2012, Russell Wallace wrote: > On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard wrote: > > Like I said even if the new file is a "cpp" file, should CMake add > > it to add_executable or add_library or... > > If different C++ source files have different purposes, I would put > th