[CMake] Need help with GLOB expression

Robert Dailey rcdailey at gmail.com
Sun Mar 29 19:54:02 EDT 2009


On Sun, Mar 29, 2009 at 4:14 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> James Bigler wrote:
>
>> Ah, yes.  I also was getting globbing expressions and regular
>> expressions mixed up.
>>
>>  From the docs (and experimentation), it looks like CMake only supports
>>>
>> *, ?, and [], but not {} which would be required to do what we want:
>>
>> file(GLOB_RECURSE sources "*.{h,cpp}")
>>
>>
> CMake uses a simple conversion from glob to regex, the code for that can be
> found here:
>
>
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Source/kwsys/Glob.cxx?revision=1.16&root=CMake&view=markup
>
> It does a simple glob with *,?, and [], and that is about it.
>
> The best thing to do would be to try using a glob expression from a bash
> shell and ls.  For example, the first one you gave does not work .[hi]pp.
>  It was added to cmake to give simple globs like *.c *.cxx *.h, etc.


But it does work! I've tested it several times with much success! I'm not
sure what you're saying about *.c, *.cxx, and *.h. Could you explain? Also,
I won't have access to a bash shell on Windows. I'd rather CMake just work
instead of trying to find silly workarounds like this.

I'll put in the feature request for {} and at some point in the future it
can be addressed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090329/69a54393/attachment.htm>


More information about the CMake mailing list