[CMake] Need help with GLOB expression

Robert Dailey rcdailey at gmail.com
Mon Mar 30 12:38:05 EDT 2009


On Sun, Mar 29, 2009 at 11:46 PM, James Bigler <jamesbigler at gmail.com>wrote:

> Why doesn't *.[hi]pp work?  It works for me with ls and with file(GLOB):
>
> $ touch blah.hpp blah2.ipp
> $ ls *.[hi]pp
> blah.hpp        blah2.ipp
>
> Also, if the glob expressions get translated into regular expressions,
> is there any way we could get access to creating regular expressions?
>
> find . -E -regex ""
>
> That's essentially what's going on under the hood, right?
>
> I filed a bug to make the documentation more clear
> (http://public.kitware.com/Bug/view.php?id=8814).
>
> I also looked into the bash man page.  Curly braces {} are filed under
> Brace Expansion while the globbing characters (*,?,[]) were under
> Pathname Expansion.  The only discerning difference between the two
> expansions is whether or not the files have to exist (Brace Expansion
> allows for arbitrary string creation where the file names need not
> exist).
>
> I suspect CMake could add support for curly braces, but it might be
> easier to add support for regular expressions instead since the
> machinery already uses regex under the hood.


But the goal for CMake in regards to globbing should be to implement what is
most usable and most practical. Just because regex is easier to implement
does not make it the most practical/useful path. Personally I think regex
would be a bit overkill for most of the globbing I do. However, I think if
the majority of the CMake community would find it useful then I would add
regex.

In the end, as long as CMake isn't limiting my ability to solve issues
within CMake's problem domain then I am happy.

Perhaps CMake could consider adding a file( REGEX ) or something for regular
expressions. This would be a little more intuitive and usable, since mixing
regex and glob is a bit misleading and confusing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090330/dcb8af76/attachment.htm>


More information about the CMake mailing list