file(GLOB sub-dirs-of-dir-name ${dir-name}/*)

should return only files within "${dir-name}" regardless of the
current working directory.


HTH,
David


On Mon, Jul 25, 2011 at 7:50 AM, Julien Dardenne
<julien.darde...@technooliq.com> wrote:
>
> Hi,
>
> is it possible to list the subdirectories from a given folder?
> I use this function but it returns me the file in the current 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 the FILE() with a different path than the current path.
>
> Thank you for your help
>
> --
> _______________________________________________
> 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
_______________________________________________
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

Reply via email to