Fixed Visual C++ language detection

This commit is contained in:
Groove 2018-07-20 00:40:49 +02:00
parent 3b98e220bc
commit 9a0311f327
2 changed files with 20 additions and 8 deletions

View File

@ -21,27 +21,27 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(GLM_TEST_ENABLE_CXX_20)
set(CMAKE_CXX_STANDARD 20)
add_definitions(-DGLM_FORCE_CXX2A)
# add_definitions(-DGLM_FORCE_CXX2A)
message(STATUS "GLM: Build with C++20 features")
elseif(GLM_TEST_ENABLE_CXX_17)
set(CMAKE_CXX_STANDARD 17)
add_definitions(-DGLM_FORCE_CXX17)
# add_definitions(-DGLM_FORCE_CXX17)
message(STATUS "GLM: Build with C++17 features")
elseif(GLM_TEST_ENABLE_CXX_14)
set(CMAKE_CXX_STANDARD 14)
add_definitions(-DGLM_FORCE_CXX14)
# add_definitions(-DGLM_FORCE_CXX14)
message(STATUS "GLM: Build with C++14 features")
elseif(GLM_TEST_ENABLE_CXX_11)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DGLM_FORCE_CXX11)
# add_definitions(-DGLM_FORCE_CXX11)
message(STATUS "GLM: Build with C++11 features")
elseif(GLM_TEST_ENABLE_CXX_98)
set(CMAKE_CXX_STANDARD 98)
add_definitions(-DGLM_FORCE_CXX98)
# add_definitions(-DGLM_FORCE_CXX98)
message(STATUS "GLM: Build with C++98 features")
endif()
@ -57,7 +57,9 @@ else()
set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/Za)
add_compile_options(/permissive-)
if(MSVC15)
add_compile_options(/permissive-)
endif()
endif()
endif()

View File

@ -133,8 +133,18 @@
#elif defined(GLM_FORCE_CXX98)
# define GLM_LANG GLM_LANG_CXX98
#else
# ifdef _MSVC_LANG
# define GLM_LANG_PLATFORM _MSVC_LANG
# if GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG)
# if GLM_COMPILER >= GLM_COMPILER_VC15_7
# define GLM_LANG_PLATFORM _MSVC_LANG
# elif GLM_COMPILER >= GLM_COMPILER_VC15
# if _MSVC_LANG > 201402L
# define GLM_LANG_PLATFORM 201402L
# else
# define GLM_LANG_PLATFORM _MSVC_LANG
# endif
# else
# define GLM_LANG_PLATFORM 0
# endif
# else
# define GLM_LANG_PLATFORM 0
# endif