[CMake] Executable depending on all source files

Alexander Neundorf a.neundorf-work at gmx.net
Sun Aug 26 08:28:14 EDT 2012


On Sunday 26 August 2012, Russell Wallace wrote:
> On Sun, Aug 26, 2012 at 8:55 AM, Eric Noulard <eric.noulard at gmail.com> 
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 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.
> 
> That's okay, I'm happy to trigger the refresh by deleting and
> re-creating the build directory. 

No need to do that, you can rerun cmake either by manually rerunning it, e.g. 
in the buildtree simply do "cmake .", or via "make rebuild_cache".

So if you use
file(GLOB ....)
in the CMakeLists.txt to collect your source files, "make rebuild_cache" will 
rerun cmake and glob again.

Alex


More information about the CMake mailing list