From 5d2332b0cb3dcd5923741370275149479aba0b0d Mon Sep 17 00:00:00 2001 From: "Evgeniy A. Dushistov" Date: Fri, 24 Jun 2022 20:10:43 +0300 Subject: [PATCH] use cmake to check if compiler supports c++11 --- CMakeLists.txt | 4 ++++ cmake/compiler.cmake | 13 ------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15da246..3d1b26e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index cf94ed3..58a627a 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -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)