Permalink
Browse files

Changed VS version to MSVC version and added support for VS 2013 and …

…TDM compilers.
  • Loading branch information...
1 parent 3670eec commit 004c12cfd2e4076d6ac5c8105948fa052e4a4406 @eXpl0it3r eXpl0it3r committed Oct 15, 2013
Showing with 18 additions and 10 deletions.
  1. +8 −4 cmake/Config.cmake
  2. +10 −6 cmake/Macros.cmake
View
@@ -45,6 +45,8 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
set(SFML_COMPILER_GCC 1)
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}")
+ execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
+ 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.*")
@@ -53,13 +55,15 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
elseif(MSVC)
set(SFML_COMPILER_MSVC 1)
if(MSVC_VERSION EQUAL 1400)
- set(SFML_MSVC_VERSION 2005)
+ set(SFML_MSVC_VERSION 8)
elseif(MSVC_VERSION EQUAL 1500)
- set(SFML_MSVC_VERSION 2008)
+ set(SFML_MSVC_VERSION 9)
elseif(MSVC_VERSION EQUAL 1600)
- set(SFML_MSVC_VERSION 2010)
+ set(SFML_MSVC_VERSION 10)
elseif(MSVC_VERSION EQUAL 1700)
- set(SFML_MSVC_VERSION 2011)
+ set(SFML_MSVC_VERSION 11)
+ elseif(MSVC_VERSION EQUAL 1800)
+ set(SFML_MSVC_VERSION 12)
endif()
else()
message(FATAL_ERROR "Unsupported compiler")
View
@@ -37,8 +37,8 @@ macro(sfml_static_add_libraries target)
if(NOT ${lib} MATCHES ".*\\.lib")
set(lib ${lib}.lib)
endif()
- if(MSVC_IDE AND SFML_MSVC_VERSION LESS 2010)
- # for Visual Studio projects < 2010, we must add double quotes
+ if(MSVC_IDE AND SFML_MSVC_VERSION LESS 10)
+ # for Visual Studio projects < 10, we must add double quotes
# around paths because they may contain spaces
set(LIBRARIES "${LIBRARIES} &quot\\;${lib}&quot\\;")
else()
@@ -99,9 +99,11 @@ macro(sfml_add_library target)
set_target_properties(${target} PROPERTIES FOLDER "SFML")
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
- if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
- if(NOT SFML_GCC_VERSION VERSION_LESS "4")
+ if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
+ if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
+ elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
+ set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
endif()
endif()
@@ -182,9 +184,11 @@ macro(sfml_add_example target)
set_target_properties(${target} PROPERTIES FOLDER "Examples")
# for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
- if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
- if(NOT SFML_GCC_VERSION VERSION_LESS "4")
+ if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4")
+ if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
+ elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
+ set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
endif()
endif()

0 comments on commit 004c12c

Please sign in to comment.