Made CMake files compatible with VC++ 2011, and other minor improvements

This commit is contained in:
Laurent Gomila 2011-12-28 21:39:23 +01:00
parent 94a9dfbdfb
commit 4107505a05
3 changed files with 15 additions and 9 deletions

View File

@ -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()

View File

@ -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)
set(COMPILER_MSVC 1)
if(MSVC_VERSION EQUAL 1400)
set(MSVC_VERSION 2005)
elseif(MSVC_VERSION EQUAL 1500)
set(COMPILER_MSVC 2008)
set(MSVC_VERSION 2008)
elseif(MSVC_VERSION EQUAL 1600)
set(COMPILER_MSVC 2010)
set(MSVC_VERSION 2010)
endif()
else()
message(WARNING "Unsupported compiler")
return()

View File

@ -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} &quot\\;${lib}&quot\\;")