[Mlir-commits] [mlir] 91746ca - [mlir][cmake] Export MLIR_LINK_MLIR_DYLIB in MLIRConfig.cmake (#207336)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 8 22:06:57 PDT 2026


Author: qyingwu
Date: 2026-07-08T22:06:52-07:00
New Revision: 91746ca146d4047e9d0ec98fd7d4a3d91f88a759

URL: https://github.com/llvm/llvm-project/commit/91746ca146d4047e9d0ec98fd7d4a3d91f88a759
DIFF: https://github.com/llvm/llvm-project/commit/91746ca146d4047e9d0ec98fd7d4a3d91f88a759.diff

LOG: [mlir][cmake] Export MLIR_LINK_MLIR_DYLIB in MLIRConfig.cmake (#207336)

Fixes #197175.

`MLIRConfig.cmake` did not propagate `MLIR_LINK_MLIR_DYLIB` to out-of-tree MLIR users. Standalone projects using `find_package(MLIR CONFIG)` and `include(AddMLIR)` therefore could not observe the value used by `mlir_target_link_libraries(...)` when MLIR was configured with `-DMLIR_LINK_MLIR_DYLIB=ON`.

Export `MLIR_LINK_MLIR_DYLIB` through `MLIRConfig.cmake`.

AI tool usage:
I used ChatGPT/Codex to help understand the issue, identify the analogous LLVM CMake pattern, and draft the PR description. I manually reviewed the final patch and verification.

Added: 
    

Modified: 
    mlir/cmake/modules/CMakeLists.txt
    mlir/cmake/modules/MLIRConfig.cmake.in

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt
index 47349f0c7eb62..8a00a3d4de98c 100644
--- a/mlir/cmake/modules/CMakeLists.txt
+++ b/mlir/cmake/modules/CMakeLists.txt
@@ -59,6 +59,10 @@ set(MLIR_CONFIG_INCLUDE_DIRS
 set(MLIR_CONFIG_TABLEGEN_EXE "${MLIR_TABLEGEN_EXE}")
 set(MLIR_CONFIG_PDLL_TABLEGEN_EXE "${MLIR_PDLL_TABLEGEN_EXE}")
 set(MLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE "${MLIR_SRC_SHARDER_TABLEGEN_EXE}")
+set(MLIR_CONFIG_LINK_MLIR_DYLIB ${MLIR_LINK_MLIR_DYLIB})
+llvm_canonicalize_cmake_booleans(
+  MLIR_CONFIG_LINK_MLIR_DYLIB
+)
 
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/MLIRConfig.cmake.in

diff  --git a/mlir/cmake/modules/MLIRConfig.cmake.in b/mlir/cmake/modules/MLIRConfig.cmake.in
index 71f3e028b1e88..fd04a64ce625b 100644
--- a/mlir/cmake/modules/MLIRConfig.cmake.in
+++ b/mlir/cmake/modules/MLIRConfig.cmake.in
@@ -16,6 +16,7 @@ set(MLIR_IRDL_TO_CPP_EXE "@MLIR_CONFIG_IRDL_TO_CPP_EXE@")
 set(MLIR_INSTALL_AGGREGATE_OBJECTS "@MLIR_INSTALL_AGGREGATE_OBJECTS@")
 set(MLIR_ENABLE_BINDINGS_PYTHON "@MLIR_ENABLE_BINDINGS_PYTHON@")
 set(MLIR_ENABLE_EXECUTION_ENGINE "@MLIR_ENABLE_EXECUTION_ENGINE@")
+set(MLIR_LINK_MLIR_DYLIB @MLIR_CONFIG_LINK_MLIR_DYLIB@)
 
 set_property(GLOBAL PROPERTY MLIR_ALL_LIBS "@MLIR_ALL_LIBS@")
 set_property(GLOBAL PROPERTY MLIR_DIALECT_LIBS "@MLIR_DIALECT_LIBS@")


        


More information about the Mlir-commits mailing list