[cmake-developers] slow regex implementation in RegularExpression
Alexandru Ciobanu
alex at rogue-research.com
Thu Nov 17 15:33:08 EST 2011
On 2011-11-17, at 3:26 PM, Alexander Neundorf wrote:
>> [ Regular expressions syntax ]
>> In terms of regular expressions syntax, the only difference that I've seen
>> is that TRE treats the curly brackets "{" and "}" as special characters,
>> because it uses them for its "approximate matching". Details here:
>> http://laurikari.net/tre/documentation/regex-syntax/
>>
>> The only CMake component that uses curly brackets in a regexp is:
>> Modules/FindJNI.cmake
>> but it was trivial to fix because they were used as mere delimiters.
>
> Well, but there are cmake files out there (i.e. all existing cmake-based
> projects) which also must behave basically exactly the same as before,
> otherwise their builds might break.
>
> Not sure how to achieve this.
> A policy ?
>
Actually it is very easy to make it transparent and thus not need to modify any .cmake files.
We just need to escape the curly brackets:
{ -> \{
} -> \}
in the regular expression before compiling it.
This way we'll have full compatibility with previous regexp syntax.
sincerely,
Alex CIobanu
More information about the cmake-developers
mailing list