[CMake] matching a literal '+' in a regular expression

James Bigler bigler at cs.utah.edu
Fri May 11 15:09:39 EDT 2007


How do I match a literal '+' in a regular expression?

This matches in grep (because it doesn't treat '+' as a special 
character), but CMake says it can't compile it (for good reason if '+' 
is a special character).

"g++.*$"

I tried escaping the '+', but that didn't work either:

"g\+\+.*$"

syntax error, unexpected cal_ERROR, expecting $end (3), when parsing 
string "g\+\+.*$"

I'm trying to match string g++, g++-4.0 etc.

Thanks,
James


More information about the CMake mailing list