<br><br><div class="gmail_quote">On Thu, Feb 10, 2011 at 8:01 AM, Michael Wild <span dir="ltr">&lt;<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 02/10/2011 01:52 PM, David Cole wrote:<br>
&gt; On Thu, Feb 10, 2011 at 2:50 AM, Robert Bielik &lt;<a href="mailto:robert.bielik@xponaut.se">robert.bielik@xponaut.se</a>&gt;wrote:<br>
&gt; Michael Wild skrev 2011-02-09 16:48:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;  what about this:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; file(GLOB_RECURSE glob_results &quot;/some/pattern*&quot;)<br>
&gt;&gt;&gt; set(dirs)<br>
&gt;&gt;&gt; foreach(f IN LISTS glob_results)<br>
&gt;&gt;&gt;   get_filename_component(d &quot;${f}&quot; PATH)<br>
&gt;&gt;&gt;   list(APPEND dirs &quot;${d}&quot;)<br>
&gt;&gt;&gt; endforeach()<br>
&gt;&gt;&gt; list(REMOVE_DUPLICATES dirs)<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Yeah, works fine but it seems to be a lot slower than using the nested<br>
&gt;&gt; file(GLOB...) macro approach, but I don&#39;t know why.<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; Probably because there are thousands of files, but only tens of directories.<br>
&gt; Bang! 100x slower.<br>
&gt;<br>
<br>
</div>But the other macro also touches every file and directory and is even<br>
recursive. I think the real cost is in the list(REMOVE_DUPLICATES) call.<br></blockquote><div><br><br>Absolutely. But the number of elements in that list will be the number of files encountered in the full recursive glob, which is probably much larger than the number of elements conditionally added to the list involved in the macro approach.<br>
<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<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>