From 0ed1f2cd8611204765b8ae09773ea5152f8aa3bb Mon Sep 17 00:00:00 2001 From: neargye Date: Thu, 21 Mar 2019 16:05:37 +0500 Subject: [PATCH] clean-up cmake --- example/CMakeLists.txt | 7 +++++-- test/CMakeLists.txt | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 39b73ee..ed9727e 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,6 @@ -include_directories(${CMAKE_SOURCE_DIR}/include) +include(CheckCXXCompilerFlag) + +include_directories(${CMAKE_SOURCE_DIR}/include) set(OPTIONS "") @@ -8,7 +10,8 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clan set(OPTIONS ${OPTIONS} -std=c++17) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(OPTIONS /W4) - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.11) + check_cxx_compiler_flag(/permissive HAS_PERMISSIVE_FLAG) + if(HAS_PERMISSIVE_FLAG) set(OPTIONS ${OPTIONS} /permissive-) endif() set(OPTIONS ${OPTIONS} /std:c++17) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 330ed47..a1c8bd5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,7 +9,8 @@ set(OPTIONS "") if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") set(OPTIONS /W4) - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.11) + check_cxx_compiler_flag(/permissive HAS_PERMISSIVE_FLAG) + if(HAS_PERMISSIVE_FLAG) set(OPTIONS ${OPTIONS} /permissive-) endif() set(OPTIONS ${OPTIONS} /wd4702) # Disable warning C4702: unreachable code