Updated/fixed string comparisons in Config.cmake

SFML so far used `${CMAKE_SYSTEM_NAME} MATCHES "Windows"`. This works, but only because there's a variable `WINDOWS` having the exact same content (`Windows`).

[More information and a similar issue can be found in this SO thread.](http://stackoverflow.com/questions/21995777/cygwins-cmake-does-not-match-for-cmake-system-name)
This commit is contained in:
Mario Liebisch 2016-06-20 14:08:50 +02:00 committed by Lukas Dürrenberger
parent b1827ddb6d
commit ba9383f25e

View File

@ -1,5 +1,5 @@
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(SFML_OS_WINDOWS 1)
# don't use the OpenGL ES implementation on Windows
@ -8,15 +8,15 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# detect the architecture (note: this test won't work for cross-compilation)
include(CheckTypeSize)
check_type_size(void* SIZEOF_VOID_PTR)
if("${SIZEOF_VOID_PTR}" STREQUAL "4")
if(${SIZEOF_VOID_PTR} STREQUAL "4")
set(ARCH_32BITS 1)
elseif("${SIZEOF_VOID_PTR}" STREQUAL "8")
elseif(${SIZEOF_VOID_PTR} STREQUAL "8")
set(ARCH_64BITS 1)
else()
message(FATAL_ERROR "Unsupported architecture")
return()
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SFML_OS_UNIX 1)
if(ANDROID)
set(SFML_OS_ANDROID 1)
@ -27,11 +27,11 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# don't use the OpenGL ES implementation on Linux
set(OPENGL_ES 0)
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(SFML_OS_FREEBSD 1)
# don't use the OpenGL ES implementation on FreeBSD
set(OPENGL_ES 0)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(IOS)
set(SFML_OS_IOS 1)
@ -59,13 +59,13 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
return()
endif()
endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(SFML_OS_ANDROID 1)
# use the OpenGL ES implementation on Android
set(OPENGL_ES 1)
else()
message(FATAL_ERROR "Unsupported operating system")
message(FATAL_ERROR "Unsupported operating system or environment")
return()
endif()
@ -86,7 +86,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE)
string(STRIP "${GCC_MACHINE}" GCC_MACHINE)
if(${GCC_MACHINE} MATCHES ".*w64.*")
if(GCC_MACHINE MATCHES ".*w64.*")
set(SFML_COMPILER_GCC_W64 1)
endif()
elseif(MSVC)