[llvm] [CMake] Factor check- target deps to reduce build.ninja size by 45% (PR #223592)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 19:46:02 PDT 2026
================
@@ -2495,6 +2502,31 @@ function(add_lit_testsuites project directory)
set(ARG_FOLDER "${subproject_title}/Tests/LIT Testsuites")
endif()
+ # CMake expands the transitive closure of a custom target's dependencies
+ # onto every custom command that depends on it. For large lit test suites,
+ # repeating the full tool dependency list on every per-directory check
+ # target makes the generated Ninja file unnecessarily large. A symbolic
+ # custom command output can be named directly on Ninja's command line, so
+ # use one shared stamp to represent the dependency closure and make each
+ # check command depend only on that stamp.
+ set(use_factored_lit_dependencies OFF)
+ # TODO: Remove the CMake version fallback once LLVM requires CMake 3.31.
+ if (CMAKE_GENERATOR STREQUAL "Ninja" AND
+ CMAKE_VERSION VERSION_GREATER_EQUAL 3.27)
+ set(use_factored_lit_dependencies ON)
+ string(SHA1 lit_testsuites_id
+ "${CMAKE_CURRENT_BINARY_DIR};${project};${directory}")
----------------
rnk wrote:
Yeah, this isn't actually necessary. This is now called `check-${proj}-test-depends.stamp`.
https://github.com/llvm/llvm-project/pull/223592
More information about the llvm-commits
mailing list