On Thu, Nov 27, 2008 at 2:31 PM, Alexander Neundorf <span dir="ltr"><<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Thursday 27 November 2008, Eric Noulard wrote:<br>
> 2008/11/27 Robert Dailey <<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>>:<br>
> >> find . -name "*.c" > source_files.txt<br>
> >> edit source_files.txt and put that list of files exiplicitly into a<br>
> >> CMakeLists.txt file.<br>
> >><br>
> >> file(GLOB is a bad way to get source lists for CMake. CMake has no way<br>
> >> of knowing when new files have been put in the directory.<br>
> ><br>
> > But unless I am missing a fundamental feature somewhere, GLOB still seems<br>
> > to be the better alternative. While it may not intrinsically know when<br>
> > new files have appeared on the filesystem, the programmer can simply<br>
> > re-run the CMake command to get an updated project with the newly added<br>
> > source files without editing the CMakeLists.txt file directly.<br>
><br>
> Yes but when he add a source file, he won't necessarily remember he<br>
> MUST rerun CMake manually<br>
> so its next attempt to "build" the project will trigger either a<br>
> compile error (added header missing)<br>
> or link error (added source file not compiled).<br>
><br>
> Whereas with hard-written sources files in CMakeLists.txt, the user<br>
> will get accustomed to<br>
> "simple" CMakeList.txt editing thus CMake will relaunch itself<br>
> automatically when needed and<br>
> in particular when a CMakeLists.txt is changed.<br>
<br>
</div>Additionally it can happen from time to time that there are files in the<br>
directories which you just started to write, or forgot to delete, or somebody<br>
else sent you, or... and which you don't want to build, but which would be<br>
found by the glob.<br>
So, yes, put the files you want to have explicitely in your cmake files.</blockquote></div><br>Okay, so if I hard-code the list of files to compile, I still need to create 1 CMakeLists.txt file for each of the 20 directories containing CPP files to compile. However, this is simply to modularize the CMake script itself. I suppose I could use include() instead of add_subdirectory()?<br>