[CMake] Recursively add directories to INCLUDE_DIRECTORIES

David Doria daviddoria at gmail.com
Wed Jul 4 08:55:30 EDT 2012


On Mon, Jun 11, 2012 at 11:35 AM, GOO Creations <goocreations at gmail.com>wrote:

>  Thanks.
> I was sitting for hours trying to write this huge macro and now the
> solution isso easy.
> For future readers, here is my macro:
>
> *MACRO(HEADER_DIRECTORIES return_list)*
> *    FILE(GLOB_RECURSE new_list *.h)*
> *    SET(dir_list "")*
> *    FOREACH(file_path ${new_list})*
> *        GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)*
> *        SET(dir_list ${dir_list} ${dir_path})*
> *    ENDFOREACH()*
> *    LIST(REMOVE_DUPLICATES dir_list)*
> *    SET(${return_list} ${dir_list})*
> *ENDMACRO()*
>
> FYI - I added this here:
http://www.vtk.org/Wiki/CMake/Examples#Recursively_add_subdirectories_to_INCLUDE_DIRECTORIES

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120704/a72006eb/attachment.htm>


More information about the CMake mailing list