LaurentGomila/SFML — Issue #141: CMake error with Visual Studio 11
Author: marcin1147
Created: 2011-12-28 12:32:14+00:00
State: open

I can't generate makefiles with CMake and Visual Studio 11. Bug is here: /cmake/Config.cmake lines 36 to 50.

I suggest to change this code:
# detect the compiler and its version
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)
else()
message(WARNING "Unsupported compiler")
return()
endif()

To this:
# detect the compiler and its version
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)
else()
set(COMPILER_MSVC 2010)
endif()