I'm having a stange behavior on cygwin using cmake. I try to check the OS in my CMakeLists.txt but is seems that this particular case does not work... Here is an example that raises my problem:
set (FOO "BAR")
message(${CMAKE_SYSTEM_NAME})
if (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
message("EQUALS CYGWIN")
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN")
message("MATCHES CYGWIN")
endif()
if (${FOO} MATCHES "BAR")
message("MATCHES BAR")
endif()
CMake prints:
CYGWIN
EQUALS CYGWIN
MATCHES BAR
And not the expected "MATCHES CYGWIN". I find this weird that it works for other variables (like FOO here). Is there something I am doing wrong?
Configuration:
- cmake version 2.8.11.2
- uname CYGWIN_NT-6.1
PS: I also checked with FOO = "CYGWIN", and it does not match neither. It seems that just this particular string does not work with MATCHES...