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

Mészáros Gergely via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 04:13:04 PDT 2024


https://github.com/Maetveis created https://github.com/llvm/llvm-project/pull/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 su[pport this flag.

>From 858a72ed6148c3c9bd8c82a6733499e7dce75b2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Gergely?= <gergely.meszaros at intel.com>
Date: Tue, 8 Oct 2024 13:12:27 +0200
Subject: [PATCH] [llvm][cmake][Trivial] use /Zc:preprocessor with MSVC only
 explicitly

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 su[pport this flag.
---
 llvm/cmake/modules/HandleLLVMOptions.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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