Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Gringauze <annagrin@microsoft.com>2018-06-15 20:13:11 +0300
committerGitHub <noreply@github.com>2018-06-15 20:13:11 +0300
commit21cb6bb8b0fbfb06c30ef273cd0a59f8a6b06a39 (patch)
tree984180b435a8308a020edc595405d8afe0a2617d /CMakeLists.txt
parenta9ef39f14ac2b0e732b22122e5fabb8dae8284db (diff)
Added testing for c++17 to latest compilers with test with (#692)
* Added testing with std=c++17 for latest compilers Added running latest compilers with -std=c++17 option to CI the test matrix, Updated cmake configuration to allow passing c++ standard on the command line. * attempt to fix appveyor break * added clang6.0, removed c++17 tests for clang 5.0 * commented out tests for clang with c++17 die to issue #695 * Addresed comments
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 14 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e96fb64..b0de85d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,32 +14,28 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(GSL_STANDALONE_PROJECT ON)
endif ()
+set(GSL_CXX_STANDARD "14" CACHE STRING "Use c++ standard")
+set(GSL_CXX_STD "cxx_std_${GSL_CXX_STANDARD}")
-include(CheckCXXCompilerFlag)
-if (NOT MSVC)
- CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
+if (MSVC)
+ set(GSL_CXX_STD_OPT "-std:c++${GSL_CXX_STANDARD}")
else()
- CHECK_CXX_COMPILER_FLAG("-std:c++14" COMPILER_SUPPORTS_CXX14)
+ set(GSL_CXX_STD_OPT "-std=c++${GSL_CXX_STANDARD}")
endif()
# when minimum version required is 3.8.0 remove if below
# both branches do exactly the same thing
if (CMAKE_VERSION VERSION_LESS 3.7.9)
- if (NOT MSVC)
- if(COMPILER_SUPPORTS_CXX14)
- target_compile_options(GSL INTERFACE "-std=c++14")
- else()
- message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
- endif()
+ include(CheckCXXCompilerFlag)
+ CHECK_CXX_COMPILER_FLAG("${GSL_CXX_STD_OPT}" COMPILER_SUPPORTS_CXX_STANDARD)
+
+ if(COMPILER_SUPPORTS_CXX_STANDARD)
+ target_compile_options(GSL INTERFACE "${GSL_CXX_STD_OPT}")
else()
- if(COMPILER_SUPPORTS_CXX14)
- target_compile_options(GSL INTERFACE "-std:c++14")
- else()
- message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.")
- endif()
+ message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++${GSL_CXX_STANDARD} support. Please use a different C++ compiler.")
endif()
else ()
- target_compile_features(GSL INTERFACE cxx_std_14)
+ target_compile_features(GSL INTERFACE "${GSL_CXX_STD}")
# on *nix systems force the use of -std=c++XX instead of -std=gnu++XX (default)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
@@ -49,6 +45,8 @@ target_compile_definitions(GSL INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:
# remove unnecessary warnings about unchecked iterators
_SCL_SECURE_NO_WARNINGS
+ # remove deprecation warnings about std::uncaught_exception() (from catch)
+ _SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING
>
)