Use CMAKE_CXX_STANDARD

Use CMAKE_CXX_STANDARD to activate C++14 support in compilers
This commit is contained in:
degaart 2015-12-23 09:25:18 +03:00
parent e5ce1fd2e6
commit b56df594ae

View File

@ -29,15 +29,23 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
endif(APPLE) endif(APPLE)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) if(CMAKE_VERSION VERSION_LESS 3.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
else() if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif() endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") set(CMAKE_CXX_STANDARD 14)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
add_definitions(-DUNICODE -D_UNICODE) add_definitions(-DUNICODE -D_UNICODE)
endif() endif()