[CMake] Re: POSIX regex support

Pau Garcia i Quiles pgquiles at elpauer.org
Fri Aug 10 15:50:21 EDT 2007


Quoting Bill Hoffman <bill.hoffman at kitware.com>:

> Pau Garcia i Quiles wrote:
>>
>> I took a quick look a few weeks ago and replacing the current regex  
>>  library with PCRE seems "easy" (most of the work would be  
>> replacing  the regexp's in current .cmake files with their POSIX  
>> equivalents).  Is Kitware or anyone else already working on that?
> Sounds like a backwards compatibility problem....   I am sure we would
> break tons of projects if we changed the REGEX format in cmake.
>
>
> -Bill

That was my first thought, too, but we could keep backwards  
compatibility easily.

It'd just be a matter of having something like:
SET( REGULAR_EXPRESSIONS CMAKE_CLASSICAL)
or
SET( REGULAR_EXPRESSIONS POSIX)

Even better, prepending an unusual-enough character we could have both  
regular expressions at once in the same project. Say we decide "~" is  
that character. If we write STRING( REGEX_MATCH "whatever" MYOUTVAR  
${MYINPUTTEXT} ) CMake uses current regular expressions, if we write  
STRING( REGEX_MATCH "~whatever" MYOUTVAR ${MYINPUTTEXT} ) CMake uses  
POSIX regular epxressions. To match "~" we would use it escaped: "\~".

Another option would be to have something like STRING(  
POSIX_REGEX_MATCH ...), etc but I like the "~" better.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list