[Mlir-commits] [mlir] [MLIR][CMake] Disable PCH reuse for C API libraries (PR #182862)

Alexis Engelke llvmlistbot at llvm.org
Mon Feb 23 07:00:11 PST 2026


https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/182862

C API libraries override the symbol visibility default, which is incompatible with PCH.

>From 658e020cca1c606e489270a3992418e6a77bab4a Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Mon, 23 Feb 2026 14:42:21 +0000
Subject: [PATCH] [MLIR][CMake] Disable PCH reuse for C API libraries

C API libraries override the symbol visibility default, which is
incompatible with PCH.
---
 mlir/cmake/modules/AddMLIR.cmake | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index be28a2ab900c9..76e6e0c1f3833 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -675,6 +675,9 @@ function(add_mlir_public_c_api_library name)
     ENABLE_AGGREGATION
     ADDITIONAL_HEADER_DIRS
     ${MLIR_MAIN_INCLUDE_DIR}/mlir-c
+
+    # Disable PCH reuse due to non-default symbol visibility.
+    DISABLE_PCH_REUSE
   )
   # API libraries compile with hidden visibility and macros that enable
   # exporting from the DLL. Only apply to the obj lib, which only affects



More information about the Mlir-commits mailing list