From 4959ffbe6edc2ece330c940f3b265f093ee89df9 Mon Sep 17 00:00:00 2001 From: Levin Li Date: Fri, 12 Mar 2021 13:33:02 +0800 Subject: [PATCH] Correctly set __cplusplus with /Zc:__cplusplus --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d90c3c57c..98b6bd636 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,11 @@ if(MSVC) # Promoted to errors # C4316: object allocated on the heap may not be aligned 16 add_compile_options("/wd4244" "/wd4267" "/wd4503" "/wd4800" "/wd4455" "/wd5030" "/bigobj" "/we4316") + + if(MSVC_VERSION GREATER_EQUAL 1914) + # /Zc:__cplusplus: correctly set __cplusplus macro value + add_compile_options("/Zc:__cplusplus") + endif() endif() if(NOT WIN32)