diff --git a/CMakeLists.txt b/CMakeLists.txt index f428bc668..463e473a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if(NOT BUILD_SHARED_LIBS) endif() # remove SL security warnings with Visual C++ -if(MSVC) +if(COMPILER_MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index c0e700803..04217c6d6 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -29,8 +29,11 @@ include(CheckTypeSize) check_type_size(void* SIZEOF_VOID_PTR) if(${SIZEOF_VOID_PTR} MATCHES "^4$") set(ARCH_32BITS 1) -else() +elseif(${SIZEOF_VOID_PTR} MATCHES "^8$") set(ARCH_64BITS 1) +else() + message(WARNING "Unsupported architecture") + return() endif() # detect the compiler and its version @@ -38,12 +41,15 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(COMPILER_GCC 1) execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT) string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" GCC_VERSION "${GCC_VERSION_OUTPUT}") -elseif(MSVC_VERSION EQUAL 1400) - set(COMPILER_MSVC 2005) -elseif(MSVC_VERSION EQUAL 1500) - set(COMPILER_MSVC 2008) -elseif(MSVC_VERSION EQUAL 1600) - set(COMPILER_MSVC 2010) +elseif(MSVC) + set(COMPILER_MSVC 1) + if(MSVC_VERSION EQUAL 1400) + set(MSVC_VERSION 2005) + elseif(MSVC_VERSION EQUAL 1500) + set(MSVC_VERSION 2008) + elseif(MSVC_VERSION EQUAL 1600) + set(MSVC_VERSION 2010) + endif() else() message(WARNING "Unsupported compiler") return() diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 6cb03aaa6..65c6c4a5a 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -33,7 +33,7 @@ macro(sfml_static_add_libraries target) if(NOT ${lib} MATCHES ".*\\.lib") set(lib ${lib}.lib) endif() - if(MSVC_IDE AND COMPILER_MSVC LESS 2010) + if(MSVC_IDE AND MSVC_VERSION LESS 2010) # for Visual Studio projects < 2010, we must add double quotes # around paths because they may contain spaces set(LIBRARIES "${LIBRARIES} "\\;${lib}"\\;")