[clang] [llvm] [mlir] [CMake] Add dependent project mode for Flang's MLIR (PR #221724)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 13:58:24 PDT 2026


================
@@ -270,14 +270,26 @@ add_subdirectory(lib/CAPI)
 
 if (MLIR_INCLUDE_TESTS)
   add_definitions(-DMLIR_INCLUDE_TESTS)
-  add_custom_target(MLIRUnitTests)
-  set_target_properties(MLIRUnitTests PROPERTIES FOLDER "MLIR/Tests")
-  if (TARGET llvm_gtest)
-    add_subdirectory(unittests)
+  set(mlir_explicit_projects "$CACHE{LLVM_ENABLE_PROJECTS}")
+  if(mlir_explicit_projects STREQUAL "all")
+    set(mlir_explicit_projects ${LLVM_ALL_PROJECTS})
+  endif()
+  if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS AND
+      NOT "mlir" IN_LIST mlir_explicit_projects)
+    # Make test support libraries available to dependent projects without
+    # registering MLIR's own unit and regression tests with check-all.
+    add_subdirectory(test/lib)
----------------
jhuber6 wrote:

Alright, I was just wondering why it needed special handling and if it would change anything else.

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


More information about the cfe-commits mailing list