Better compiler detection in CMake. Language detection for Clang
This commit is contained in:
@@ -11,31 +11,33 @@ if(NOT GLM_TEST_ENABLE)
|
||||
message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
||||
if(GLM_TEST_ENABLE_CXX_11)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-std=c++0x)
|
||||
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
|
||||
option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
|
||||
option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF)
|
||||
option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF)
|
||||
option(GLM_TEST_ENABLE_CXX_1Y "Enable C++ 1y" OFF)
|
||||
option(GLM_TEST_ENABLE_CXX_PEDANTIC "Pedantic" ON)
|
||||
|
||||
if(GLM_TEST_ENABLE_CXX_PEDANTIC)
|
||||
add_definitions(-pedantic)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_CXX_11)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(GLM_TEST_ENABLE_CXX_1Y)
|
||||
add_definitions(-std=c++1y)
|
||||
elseif(GLM_TEST_ENABLE_CXX_11)
|
||||
add_definitions(-std=c++11)
|
||||
elseif(GLM_TEST_ENABLE_CXX_0X)
|
||||
add_definitions(-std=c++0x)
|
||||
elseif(GLM_TEST_ENABLE_CXX_98)
|
||||
add_definitions(-std=c++98)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF)
|
||||
if(GLM_TEST_ENABLE_MS_EXTENSIONS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
#Doesn't seem to work...
|
||||
#add_definitions(-fms-extensions)
|
||||
#add_definitions(-D_MSC_EXTENSIONS)
|
||||
endif()
|
||||
elseif(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-pedantic)
|
||||
endif()
|
||||
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND WIN32))
|
||||
option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/Za)
|
||||
if(NOT GLM_TEST_ENABLE_MS_EXTENSIONS)
|
||||
add_definitions(/Za)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user