[CMake] Help for File command

Julien Dardenne julien.dardenne at technooliq.com
Thu Jul 21 02:52:43 EDT 2011


Hi,

is it possibleto list thesubdirectoriesfrom agiven folder?
I usethis functionbut itreturnsmethefilein thecurrent path.

macro(list_subdirectories retval curdir return_relative)

   file(GLOB sub-dir RELATIVE ${curdir} *)
   set(list_of_dirs "")
   foreach(dir ${sub-dir})
     if(IS_DIRECTORY ${curdir}/${dir})
       if (${return_relative})
         set(list_of_dirs ${list_of_dirs} ${dir})
       else()
         set(list_of_dirs ${list_of_dirs} ${curdir}/${dir})
       endif()
     endif()
   endforeach()
   set(${retval} ${list_of_dirs})
endmacro()

I can notuse theFILE() witha different paththanthe currentpath.

Thank you foryour help

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110721/eba82ff2/attachment-0001.htm>


More information about the CMake mailing list