[CMake] IF(string) is false. Why?
Brandon Van Every
bvanevery at gmail.com
Tue Oct 30 18:34:20 EDT 2007
IF("WHATEVER")
MESSAGE("WHATEVER string is true")
ELSE("WHATEVER")
MESSAGE("WHATEVER string is false")
ENDIF("WHATEVER")
C:\devel\src\cbugs\trueorfalse>cmake -P trueorfalse.cmake
WHATEVER string is false
I would expect the literal string "WHATEVER" to evaluate to true. By
analogy to IF(variable) as per the docs. The practical application is
I'm trying to sanity check an argument that's a literal string.
MACRO(DOSOMETHING literal_string result)
IF(${literal_string})
SET(result "valid")
ELSE(${literal_string})
MESSAGE(SEND_ERROR "I don't like the input!")
ENDIF(${literal_string})
ENDMACRO(DOSOMETHING)
DOSOMETHING("WHATEVER" out)
C:\devel\src\cbugs\trueorfalse>cmake -P trueorfalse.cmake
CMake Error: I don't like the input!
Cheers,
Brandon Van Every
More information about the CMake
mailing list