[CMake] if(string MATCHES regex) question
Marcel Loose
loose at astron.nl
Fri Jul 3 12:54:26 EDT 2009
Wow,
So this really is ancient code!
Thanks for the explanation.
Best regards,
Marcel Loose
On Fri, 2009-07-03 at 07:59 -0400, Brad King wrote:
> Eric Noulard wrote:
> >> If so, I still don't quite get the usage pattern in, e.g.,
> >> CheckIncludeFile.cmake. What are they trying to check?
> >
> > Better ask the author of this file :-)
>
> This was a hack left from before the 'DEFINED' option was
> available from the if() command. The code
>
> if(VAR MATCHES "^VAR$")
>
> is almost equivalent to
>
> if(NOT DEFINED VAR)
>
> because the if() command replaces VAR with ${VAR} implicitly
> when VAR is defined (but '^VAR$' is not defined and does not
> get replaced). The implicit conversion is left from *very*
> early CMake when there was no ${} syntax.
>
> -Brad
More information about the CMake
mailing list