[CMake] What does this mean: IF("${VARIABLE}"
MATCHES "^${VARIABLE}$")
Bill Hoffman
bill.hoffman at kitware.com
Tue Dec 11 08:16:06 EST 2007
Jian Wang wrote:
> Why is IF("${VARIABLE}" MATCHES "^${VARIABLE}$") used instead of IF(
> ${VARIABLE} STREQUAL ${VARIABLE} ) (which would always return true)?
> I'm not sure of use case but I'd say it's checking for special
> characters in VARIABLE.
>
> If it's checking for special characters then I have to say that it's not
> the right way. For example, if VARIABLE == "a/b" then the IF statement
> is still TRUE.
It is checking to see if the VARIABLE has a value at all. It is old
code before we had IF(DEFINED VARIABLE) but works with all versions of
CMake.
-Bill
More information about the CMake
mailing list