On Thu, Nov 27, 2008 at 2:31 PM, Alexander Neundorf <span dir="ltr">&lt;<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>&gt;</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>
&gt; 2008/11/27 Robert Dailey &lt;<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>&gt;:<br>
&gt; &gt;&gt; find . -name &quot;*.c&quot; &gt; source_files.txt<br>
&gt; &gt;&gt; edit source_files.txt and put that list of files exiplicitly into a<br>
&gt; &gt;&gt; CMakeLists.txt file.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; file(GLOB is a bad way to get source lists for CMake. &nbsp; CMake has no way<br>
&gt; &gt;&gt; of knowing when new files have been put in the directory.<br>
&gt; &gt;<br>
&gt; &gt; But unless I am missing a fundamental feature somewhere, GLOB still seems<br>
&gt; &gt; to be the better alternative. While it may not intrinsically know when<br>
&gt; &gt; new files have appeared on the filesystem, the programmer can simply<br>
&gt; &gt; re-run the CMake command to get an updated project with the newly added<br>
&gt; &gt; source files without editing the CMakeLists.txt file directly.<br>
&gt;<br>
&gt; Yes but when he add a source file, he won&#39;t necessarily remember he<br>
&gt; MUST rerun CMake manually<br>
&gt; so its next attempt to &quot;build&quot; &nbsp;the project will trigger either a<br>
&gt; compile error (added header missing)<br>
&gt; or link error (added source file not compiled).<br>
&gt;<br>
&gt; Whereas with hard-written sources files in CMakeLists.txt, the user<br>
&gt; will get accustomed to<br>
&gt; &quot;simple&quot; CMakeList.txt editing thus CMake will relaunch itself<br>
&gt; automatically when needed and<br>
&gt; 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&#39;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>