mirror of
https://github.com/Dushistov/sdcv.git
synced 2025-12-13 00:31:55 +00:00
use cmake to check if compiler supports c++11
This commit is contained in:
committed by
Evgeniy Dushistov
parent
b77c0e793a
commit
e72220e748
@@ -3,6 +3,10 @@ project(sdcv)
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
cmake_policy(VERSION 3.5)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_CXX_EXTENSIONS False)
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler.cmake")
|
||||
|
||||
set(ZLIB_FIND_REQUIRED True)
|
||||
|
||||
@@ -16,19 +16,6 @@ if (NOT DEFINED SDCV_COMPILER_IS_GCC_COMPATIBLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC AND (MSVC_VERSION LESS 1900))
|
||||
message(FATAL_ERROR "MSVC version ${MSVC_VERSION} have no full c++11 support")
|
||||
elseif (MSVC)
|
||||
add_definitions(-DNOMINMAX)
|
||||
elseif (NOT MSVC)
|
||||
check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
|
||||
if (CXX_SUPPORTS_CXX11)
|
||||
append("-std=c++11" CMAKE_CXX_FLAGS)
|
||||
else ()
|
||||
message(FATAL_ERROR "sdcv requires C++11 support but the '-std=c++11' flag isn't supported.")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (SDCV_COMPILER_IS_GCC_COMPATIBLE)
|
||||
append("-Wall" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_C_FLAGS)
|
||||
append("-Wall" "-pedantic" "-Wextra" "-Wformat-security" "-Wcast-align" "-Werror=format" "-Wcast-qual" CMAKE_CXX_FLAGS)
|
||||
|
||||
Reference in New Issue
Block a user