[CMake] if(string MATCHES regex) question
Brad King
brad.king at kitware.com
Fri Jul 3 07:59:35 EDT 2009
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