[Cmake] Regular expression ++ nesting problem

Brad King brad.king at kitware.com
Thu, 26 Feb 2004 09:24:24 -0500


David Svoboda wrote:
> Hello,
> 
> I used the following construction:
> 
> IF ("${MY_STRING_PATH}" MATCHES "${CHOSEN_PATH}.*")
> 	...
> 
> 
> to test, whether CHOSEN_PATH is included in MY_STRING_PATH. Everything had
> worked well until I tried SET(CHOSEN_PATH /usr/local/packages/g++-3.0).
> Here the variable CHOSEN_PATH contains the "+" sign (twice) and causes
> errors in CMake:
> 
> 
> ***
> -- Check for working C compiler: gcc -- works
> -- Check for working CXX compiler: g++-3.0 -- works
> RegularExpression::compile(): Nested *?+.
> RegularExpression::compile(): Error in compile.
> RegularExpression::compile(): Nested *?+.
> RegularExpression::compile(): Error in compile.
> -- Configuring done
> -- Generating done
> ***
> 
> 
> I tried some "\" or "'" signs, but it did not work. Could anybody help me?

The "MATCHES" expression in an IF statement should always be written by 
hand due to the reason you just encountered.  If you have a string you 
want to compare, use the "STRING" command.  See "cmake --help STRING" 
for details.

-Brad