[llvm] 3f601a0 - [llvm][cmake][Trivial] don't use `/Zc:preprocessor` with clang-cl

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 04:02:19 PST 2023


Author: Markus Böck
Date: 2023-02-09T13:02:29+01:00
New Revision: 3f601a0a8c2ddb9482c9eb54dbde8a7a074a7aad

URL: https://github.com/llvm/llvm-project/commit/3f601a0a8c2ddb9482c9eb54dbde8a7a074a7aad
DIFF: https://github.com/llvm/llvm-project/commit/3f601a0a8c2ddb9482c9eb54dbde8a7a074a7aad.diff

LOG: [llvm][cmake][Trivial] don't use `/Zc:preprocessor` with clang-cl

The flag is not recognized by clang-cl and emits unused command line warning for every translation unit

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 7d65304b2ac77..1ac9a20513bff 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -494,9 +494,11 @@ 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)
+  if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    # Enable standards-conforming preprocessor.
+    # https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
+    append("/Zc:preprocessor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+  endif ()
 
   # Some projects use the __cplusplus preprocessor macro to check support for
   # a particular version of the C++ standard. When this option is not specified


        


More information about the llvm-commits mailing list