[llvm] 97a784e - [llvm][cmake][Trivial] use /Zc:preprocessor with MSVC only explicitly (#111520)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 06:58:28 PDT 2024


Author: Mészáros Gergely
Date: 2024-10-08T15:58:25+02:00
New Revision: 97a784ecacef82ea72f2e86892521e5e6aabf55d

URL: https://github.com/llvm/llvm-project/commit/97a784ecacef82ea72f2e86892521e5e6aabf55d
DIFF: https://github.com/llvm/llvm-project/commit/97a784ecacef82ea72f2e86892521e5e6aabf55d.diff

LOG: [llvm][cmake][Trivial] use /Zc:preprocessor with MSVC only explicitly (#111520)

Only MSVC recognizes this flag, so be explicit. As an example the Intel
C++ Compiler (IntelLLVM in CMake) also has an MSVC compatible CLI, but
does not suppport this flag.

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index e17e2169cd880f..dd3613679ec569 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -581,7 +581,7 @@ if( MSVC )
 
   append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 
-  if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
     # Enable standards-conforming preprocessor.
     # https://learn.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
     append("/Zc:preprocessor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)


        


More information about the llvm-commits mailing list