From c418b1d3f40855d068f34d6f9b8166962f0565e0 Mon Sep 17 00:00:00 2001 From: o-micron Date: Tue, 10 Mar 2020 04:12:35 +0200 Subject: [PATCH] Check for a bug fix on string_view and msvc 140 and 141 --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 663bb864..e5e3cd83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,16 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.1") set(CMAKE_CXX_STANDARD_REQUIRED OFF) endif() +if(WIN32) + if(MSVC) + if(MSVC_TOOLSET_VERSION EQUAL 140 OR MSVC_TOOLSET_VERSION EQUAL 140) + # there is a bug reported on https://developercommunity.visualstudio.com/content/problem/9696/c17-not-available-by-default.html + # string_view is not available unless we use the /std:c++latest switch + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest") + endif() + endif() +endif() + enable_testing() include(CMakeDependentOption)