[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
Mon Sep 7 13:56:52 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:
> What's the explicit fallout of this?
I don't quite get the question? What do you mean by "fallout" here?
The reason this line is that the test directory in MLIR contains some libraries (.a) that can be used by Clang/Flang own C++ unit-tests. The build targets need to be there to satisfy the dependencies.
https://github.com/llvm/llvm-project/pull/221724
More information about the cfe-commits
mailing list