From fd265bd7ac5185dc297d404cc6c2d7b53e670053 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 18 Oct 2024 10:23:31 +0300 Subject: [PATCH] [CMAKE] Enable proper definition of __cplusplus macro on MSVC MSVC defaults to always reporting 199711L to satisfy broken C++ code. You have to add a command line argument to make it work correctly. See https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170 --- sdk/cmake/msvc.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index 67c2e451d7b..bf804dd3bfd 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -32,6 +32,9 @@ endif() add_definitions(/D__STDC__=1) +# Enable correct values of __cplusplus macro for newer standards +add_compile_options($<$:/Zc:__cplusplus>) + # Ignore any "standard" include paths, and do not use any default CRT library. if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") add_compile_options(/X /Zl)