[Mlir-commits] [mlir] [mlir][CMake] Modify the behavior of `add_mlir_aggregate ` and add `mlir_c_target_link_libraries`. (PR #141435)

Maksim Levental llvmlistbot at llvm.org
Mon May 26 09:42:35 PDT 2025


================
@@ -565,6 +580,26 @@ function(add_mlir_aggregate name)
       "    OBJECTS = ${_local_objects}\n"
       "    DEPS = ${_local_deps}\n\n")
   endforeach()
+  
+  if (MLIR_LINK_MLIR_DYLIB)
+    # This builds a regex with all the libraries contained in `libMLIR.so`.
+    # These libraries will be filtered out from the dependencies added by the
+    # EMBED_LIBS.
+    list(GET mlir_libs 0 _libs_regex)
+    list(REMOVE_AT mlir_libs 0)
+    set(_libs_regex "(${_libs_regex}")
+    foreach (lib ${mlir_libs})
+      string(APPEND _libs_regex "|${lib}")
----------------
makslevental wrote:

> mlir_libs should contain only upstream names that are in MLIR, or MLIR-C

why? one can freely use [`add_mlir_library`](https://github.com/llvm/llvm-project/blob/main/mlir/examples/standalone/lib/Standalone/CMakeLists.txt#L1) or [`add_mlir_public_c_library`](https://github.com/llvm/llvm-project/blob/main/mlir/examples/standalone/lib/CAPI/CMakeLists.txt#L1) downstream right?

> But I'm open to ideas to harden this.

does the `_deps` need to be a genex? If not you can just do [list/set difference](https://stackoverflow.com/a/59578250)?



https://github.com/llvm/llvm-project/pull/141435


More information about the Mlir-commits mailing list