Ah.... I know what it is. If you use "GLOB_RECURSE" you only get files
because the directories are recursed into.

You have to use GLOB alone and do the recursion manually if you want to
descend into found directories... Painful. But still possible.


On Wed, Feb 9, 2011 at 10:48 AM, David Cole <david.c...@kitware.com> wrote:

> What does this return if you save it as "glob.cmake" and then run "cmake -P
> glob.cmake" ??
>
> file(GLOB results "/*")
>
> set(dirs "")
> foreach(f ${results})
>
>   if(IS_DIRECTORY "${f}")
>     set(dirs ${dirs} ${f})
>     message("directory: '${f}'")
>   else()
>     message("file: '${f}'")
>   endif()
> endforeach()
>
> message("dirs='${dirs}'")
>
>
> I get this:
>
> C:\Users\davidcole\Dashboards\My Tests>cmake -P glob.cmake
> directory: '/$RECYCLE.BIN'
> file: '/.rnd'
> directory: '/Documents and Settings'
> directory: '/found.000'
> file: '/hiberfil.sys'
> directory: '/Intel'
> directory: '/K'
> file: '/mfg.sdr'
> directory: '/MinGW'
> directory: '/MSOCache'
> file: '/pagefile.sys'
> directory: '/Program Files'
> directory: '/Program Files (x86)'
> directory: '/ProgramData'
> directory: '/Public'
> directory: '/Python26'
> directory: '/Qt'
> directory: '/Share'
> directory: '/System Recovery'
> directory: '/System Volume Information'
> directory: '/Users'
> directory: '/Windows'
> directory: '/xampp'
> dirs='/$RECYCLE.BIN;/Documents and
> Settings;/found.000;/Intel;/K;/MinGW;/MSOCache;/Program Files;/Program Files
> (x86);/ProgramData;/Public;/Python26;/Qt;/Share;/System Recovery;/System
> Volume Information;/Users;/Windows;/xampp'
>
>
>
>
>
> On Wed, Feb 9, 2011 at 10:41 AM, Robert Bielik 
> <robert.bie...@xponaut.se>wrote:
>
>> David Cole skrev 2011-02-09 16:32:
>>
>>  You can iterate the returned list something like this to accumulate just
>>> directory names:
>>>
>>> set(dirs "")
>>> foreach(f ${glob_results})
>>>   if(IS_DIRECTORY "${f}")
>>>     set(dirs ${dirs} ${f})
>>>   endif()
>>> endforeach()
>>>
>>
>> Hmm... doesn't work. find(...) doesn't return directories, only files...
>> :(
>>
>> /Rob
>>
>
>
_______________________________________________
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