1
0

CMake: Added a C++11 check for VS.

VS2010- cannot be used, VS2012 needs to have a 2012-CTP compiler installed, VS2013+ has all the features we need.
This commit is contained in:
Mattes D 2014-11-02 08:09:22 +01:00
parent 91d03bd215
commit 65b5ae0aa2

View File

@ -37,6 +37,21 @@ if(DEFINED ENV{MCSERVER_BUILD_ID})
endif()
endif()
# We need C++11 features, Visual Studio has those from VS2012, but it needs a new platform toolset for those; VS2013 supports them natively:
# Adapted from http://binglongx.wordpress.com/2013/06/28/set-non-default-platform-toolset-in-cmake/
if(MSVC OR MSVC_IDE)
if( MSVC_VERSION LESS 1700 ) # VC10- / VS2010-
message(FATAL_ERROR "The project requires C++11 features. "
"You need at least Visual Studio 11 (Microsoft Visual Studio 2012), "
"with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012).")
elseif( MSVC_VERSION EQUAL 1700 ) # VC11 / VS2012
message( "VC11: using Microsoft Visual Studio 2012 "
"with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012)" )
set(CMAKE_GENERATOR_TOOLSET "v120_CTP_Nov2012" CACHE STRING "Platform Toolset" FORCE)
else() # VC12+, assuming C++11 supported.
endif()
endif()
# This has to be done before any flags have been set up.
if(${BUILD_TOOLS})
add_subdirectory(Tools/MCADefrag/)