[CMake] Recursively add directories to INCLUDE_DIRECTORIES

Leif Walsh leif.walsh at gmail.com
Mon Jun 11 11:11:52 EDT 2012


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 <goocreations at gmail.com> wrote:

> 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 www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list