[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:18:07 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:

does this work if the lib/target name has characters that need to be escaped? e.g. the object target names are something like `obj.MLIRAffineBLAHBLAH` i.e. contain period. I realize the `obj.*` targets aren't what's added to `MLIR_STATIC_LIBS` (and thus won't be in this loop) but other people might name their targets weird things?

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


More information about the Mlir-commits mailing list