[Cmake] Regular expression ++ nesting problem
David Svoboda
xsvobod2 at informatics.muni.cz
Fri, 27 Feb 2004 11:17:06 +0100
On Thu, 26 Feb 2004, Brad King wrote:
> 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
>
I looked through the STRING(...) help. The most suitable seems the command
STRING(COMPARE LESS <string1> <string2> <output variable>)
But this command compares the length of the strings - not the string
themselves. Hence I do not know, how to test wheter the string
/usr/local/packages/omniorb-4.0.1-g++-3.0
is substring of
/usr/local/packages/omniorb-4.0.1-g++-3.0/bin/omniidl
for example. Or more precisely, if the directory
/usr/local/packages/omniorb-4.0.1-g++-3.0
contains subdirectory or application
/usr/local/packages/omniorb-4.0.1-g++-3.0/bin/omniidl
-David