<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Thanks.<br>
I was sitting for hours trying to write this huge macro and now the
solution isso easy.<br>
For future readers, here is my macro:<br>
<br>
<blockquote><i>MACRO(HEADER_DIRECTORIES return_list)</i><br>
<i> FILE(GLOB_RECURSE new_list *.h)</i><br>
<i> SET(dir_list "")</i><br>
<i> FOREACH(file_path ${new_list})</i><br>
<i> GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)</i><br>
<i> SET(dir_list ${dir_list} ${dir_path})</i><br>
<i> ENDFOREACH()</i><br>
<i> LIST(REMOVE_DUPLICATES dir_list)</i><br>
<i> SET(${return_list} ${dir_list})</i><br>
<i>ENDMACRO()</i><br>
</blockquote>
<br>
<br>
Christoph<br>
<br>
<br>
On 2012/06/11 05:11 PM, Leif Walsh wrote:
<blockquote
cite="mid:192FD156-CE25-4C3F-AB8A-01FB1818B7DE@gmail.com"
type="cite">
<pre wrap="">Use the GLOB_RECURSE mode of file() (cmake --help-command file) and get_filename_component.
Sent from my iPhone
On Jun 11, 2012, at 11:09, GOO Creations <a class="moz-txt-link-rfc2396E" href="mailto:goocreations@gmail.com"><goocreations@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,
I want to recursively scan all sub-directories (and their sub-directories, etc ...) and determine if the directory contains a header (.h) file. I then want to add this directory to INCLUDE_DIRECTORIES.
The best thing (according to my CMake knowledge) is to write a macro for this and then use it as follows:
SCAN_DIRS(mylist)
INCLUDE_DIRECTORIES(${mylist})
Any suggestions on how to implement this "SCAN_DIRS" macro?
Christoph
--
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a>
</pre>
</blockquote>
</blockquote>
<br>
</body>
</html>