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