[CMake] Executable depending on all source files

Eric Noulard eric.noulard at gmail.com
Sun Aug 26 03:55:54 EDT 2012


2012/8/25 Russell Wallace <russell.wallace at gmail.com>:
> 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 some add_executable (1 or several)
  - configure with configure_file(...)
  - simply installed with install(...)


> 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
> another poster observes, that could cause slowdown for very large
> projects. I expect to have to prompt cmake about new files (by
> cleaning up the build directory).

Like I said even if the new file is a "cpp" file, should CMake add
it to add_executable or add_library or...

I know that you want to specify the "to be added" file spec using
a GLOB expression but then what we may need currently would be
a mechanism to cleanly trigger the refresh or the list of file.
FILE(GLOB ...) was not meant for that.

In my opinion if (I don't know if it's reasonable) we would want
to fullfil your need we would need something like a new variable type:

set(MYSOURCES "*.cpp" CACHE FILELIST)

then

cmake --refresh
would freshen such type of variables.


> But that's a very different thing
> from trying to keep file lists in sync by hand!



More information about the CMake mailing list