[CMake] IF(... MATCHES WIN32) weird behavior
Brad King
brad.king at kitware.com
Tue May 31 13:33:43 EDT 2005
Filipe Sousa wrote:
> SET(arg "WIN32")
> IF("${arg}" MATCHES "WIN32")
> MESSAGE(STATUS ":)")
> ELSE("${arg}" MATCHES "WIN32")
> MESSAGE(STATUS ":(")
> ENDIF("${arg}" MATCHES "WIN32")
>
> C:\_builds\testes>cmake -G"NMake Makefiles" c:\_projects\testes
> -- :(
> -- Configuring done
> -- Generating done
> -- Build files have been written to: C:/_builds/testes
This is due to an ambiguity in the interface to the IF command left from
early CMake versions. Read the documentation for the IF command
carefully, and keep in mind that "WIN32" is defined as a variable on
Windows. Basically the left "WIN32" is getting replaced by "1" before
comparison. On non-windows systems or when you use WIN3 the variable is
not defined.
-Brad
More information about the CMake
mailing list