From eb5613563b288748c6de1d201fa91c805aa34d21 Mon Sep 17 00:00:00 2001 From: Tarcisio Rodrigues Date: Thu, 28 Jan 2021 23:58:41 -0300 Subject: [PATCH] Add /Zc:__cplusplus to MSVC compiler flags Fix build errors for a clean build on Windows. For details about the CMake teting code see https://stackoverflow.com/a/60890947/1254880 --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73e3d1f6..3a7406a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,10 @@ if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT CMAKE_SYSTEM endif() endif() +if (MSVC AND MSVC_VERSION GREATER_EQUAL 1914) + list(APPEND mi_cflags /Zc:__cplusplus) +endif() + # Architecture flags if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm" AND NOT APPLE) check_cxx_compiler_flag(-march=native CXX_SUPPORTS_MARCH_NATIVE)