CMake's STREQUAL not working

The issue was my cache. I deleted my cache and reconfigured and now the code works.


I didn't test your example at first, but when I did, I see your code works fine on cmake 2.8.0, and the other combinations advertised in the docs do too:

set( FUBARTEST "OK" )
if( FUBARTEST STREQUAL "OK" )
    message( "FUBARTEST Worked" )
else()
    message( "FUBARTEST FAILED" )
endif()

set( FOO "OK" )
if( ${FOO} STREQUAL "OK" )
    message("string STREQUAL string works" )
else ()
    message("string STREQUAL string FAILED" )

endif()

set( FOO "OK" )
set( BAR "OK" )
if( FOO STREQUAL BAR )
    message("variable STREQUAL variable works" )
else ()
    message("variable STREQUAL variable FAILED" )

endif()

set( FOO "OK" )
if( FOO STREQUAL "OK" )
    message("variable STREQUAL string works" )
else ()
    message("variable STREQUAL string FAILED" )

endif()

gives output:

FUBARTEST Worked
string STREQUAL string works
variable STREQUAL variable works
variable STREQUAL string works

Tags:

Cmake