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

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 01:10:45 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)
----------------
joker-eph wrote:

OK! Thanks for clarifying.

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


More information about the cfe-commits mailing list