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

Fabian Mora llvmlistbot at llvm.org
Mon May 26 09:29:37 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}")
----------------
fabianmcg wrote:

`mlir_libs` should contain only upstream names that are in MLIR, or MLIR-C, which never have those issues. If a downstream is adding more libs, then it's undefined behavior on their side. But I'm open to ideas to harden this.

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


More information about the Mlir-commits mailing list