From 4107505a0589404fa1a99d1f87b514a2c9edc94e Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Wed, 28 Dec 2011 21:39:23 +0100 Subject: [PATCH] Made CMake files compatible with VC++ 2011, and other minor improvements --- CMakeLists.txt | 2 +- cmake/Config.cmake | 20 +++++++++++++------- cmake/Macros.cmake | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f428bc66..463e473a 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 c0e70080..04217c6d 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 6cb03aaa..65c6c4a5 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}"\\;")