The root problem here is one of expense. It is an expensive question to ask &quot;has a single file been added or removed from this directory tree of thousands of source code files...&quot; So we never ask that question. (Doing two file(GLOB&#39;s and comparing the results to say &quot;has there been a change&quot;? is more expensive than just doing it once and assuming there has been a change...)<div>
<br></div><div>In the end, the developer always has to be trained about how to add a source file to a project.</div><div><br></div><div>If you and all of your developers *always* work like this (#1):</div><div>- make any changes you like</div>
<div>- run cmake</div><div>- run make (or build with an IDE)</div><div>...then the file(GLOB technique is feasible because your developers always run cmake before building.</div><div><br></div><div>If instead you work like this (#2):</div>
<div>- make any changes you like</div><div>- run make (or build with an IDE)</div><div>...then the file(GLOB technique does not work when you have added a source file. But the explicit listing of those files in CMakeLists.txt still works...</div>
<div><br></div><div>The developers need to know that if they add source files then cmake has to be re-run. *Unless* you explicitly list the sources in CMakeLists -- then cmake automatically reruns because the CMakeLists has changed...</div>
<div><br></div><div>Explicit listing of sources in CMakeLists.txt always works. file(GLOB only works sometimes depending on dev workflow preference.</div><div><br></div><div>That&#39;s why we always recommend explicitly listing sources.</div>
<div><br></div><div>Ignore our advice if you wish, but file(GLOB will always be an unreliable technique unless you have a magic way of enforcing workflow #1.</div><div><br></div><div><br></div><div>HTH,</div><div>David</div>
<div><br></div><div><br></div><div><br></div><div><div class="gmail_quote">On Mon, Dec 1, 2008 at 12:56 PM, Bart Janssens <span dir="ltr">&lt;<a href="mailto:bart.janssens@lid.kviv.be">bart.janssens@lid.kviv.be</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Mon, Dec 1, 2008 at 4:50 PM, &nbsp;&lt;<a href="mailto:David.Karr@l-3com.com">David.Karr@l-3com.com</a>&gt; wrote:<br>

&gt;&gt;Yes but when he add a source file, he won&#39;t necessarily remember he<br>
&gt;&gt;MUST rerun CMake manually [...]<br>
&gt;&gt;<br>
&gt;&gt;Whereas with hard-written sources files in CMakeLists.txt, the user<br>
&gt;&gt;will get accustomed to &quot;simple&quot; CMakeList.txt editing [...]<br>
&gt;&gt;<br>
&gt;&gt;[...]<br>
<br>
</div><div class="Ih2E3d">&gt; Actually, when I was last faced with this task I decided the easier<br>
&gt; alternative for me was to cut and paste a lot of boring directory<br>
&gt; listings into my CMakeLists.txt files. &nbsp;(This was in a much earlier<br>
&gt; version of CMake, and IIRC there was some problem with file globbing<br>
&gt; back then that was fixed soon afterward.)<br>
<br>
</div>Just thinking out loud here, but would it be possible for the trigger<br>
that determines whether CMake should be rerun or not to check if any<br>
files were added/removed? That would make the globbing method as<br>
convenient as the manual editing.<br>
<br>
Cheers,<br>
<br>
--<br>
<font color="#888888">Bart Janssens<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>