Reapply "[cmake][msvc] Enable standards-conforming preprocessor"
authorJan Svoboda <jan_svoboda@apple.com>
Wed, 8 Feb 2023 21:46:37 +0000 (13:46 -0800)
committerJan Svoboda <jan_svoboda@apple.com>
Wed, 8 Feb 2023 21:47:58 +0000 (13:47 -0800)
This reverts commit 16e1a49441c51817697138437d8db2c15bc19cb4, essentially reapplying 12d8e7c6ade55bba241259312e3e4bdcf6aeab81. The build bot where this caused issues is supposed to be updated now: https://reviews.llvm.org/D135128#4108588

llvm/cmake/modules/HandleLLVMOptions.cmake

index 7173e2724097a942058ed4b32f0c5d4d48ed462c..7d65304b2ac776647f67571f95cbff16ff101a88 100644 (file)
@@ -494,6 +494,10 @@ if( MSVC )
 
   append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 
+  # Enable standards-conforming preprocessor.
+  # https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
+  append("/Zc:preprocessor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
   # Some projects use the __cplusplus preprocessor macro to check support for
   # a particular version of the C++ standard. When this option is not specified
   # explicitly, macro's value is "199711L" that implies C++98 Standard.