Skip to content

[CMake] Don't override find_package() for builtins#22604

Merged
guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:issue-8633
Jun 17, 2026
Merged

[CMake] Don't override find_package() for builtins#22604
guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:issue-8633

Conversation

@guitargeek

@guitargeek guitargeek commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Targeted changes to make the find_package override unnecessary (more detail in inline comments and commit messages).

Closes #8633.

🤖 Done with the help of AI, which suggested an initial solution that I refined.

@guitargeek guitargeek self-assigned this Jun 14, 2026
@guitargeek guitargeek requested a review from bellenot as a code owner June 14, 2026 13:38
@guitargeek guitargeek added in:Build System clean build Ask CI to do non-incremental build on PR labels Jun 14, 2026
@guitargeek guitargeek changed the title [CMake] Don't override find_package() for builtins [CMake] Don't override find_package() for builtins Jun 14, 2026
@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 11h 13m 41s ⏱️
 3 865 tests  3 816 ✅   0 💤 49 ❌
72 372 runs  72 118 ✅ 205 💤 49 ❌

For more details on these failures, see this check.

Results for commit cbcfc58.

♻️ This comment has been updated with latest results.

Comment thread builtins/zlib/CMakeLists.txt Outdated

@ferdymercury ferdymercury left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just a minor nitpick

Comment thread builtins/zlib/CMakeLists.txt Outdated
Comment thread interpreter/CMakeLists.txt Outdated
builtins/zstd defined the imported ZSTD::ZSTD target but never tied it to
the BUILTIN_ZSTD ExternalProject that actually produces libzstd.a. As a
result a parallel or targeted build (e.g. building only the Core target)
could try to link the archive before it exists. Add the dependency edge,
consistent with what builtins/zlib already does for BUILTIN_ZLIB.

🤖 Done by AI.
ROOT redefined the global find_package() command to no-op for its
builtins, so that sub-projects added later (notably the bundled LLVM)
and transitive find modules (e.g. FindPNG -> find_package(ZLIB)) would
reuse ROOT's builtin imported targets instead of re-discovering a system
copy. This relied on undocumented CMake behaviour and recursed
infinitely under tools that override find_package() themselves, such as
vcpkg (root-project#8633).

The override only ever did real work for ZLIB and zstd: every other name
in ROOT_BUILTINS was unnecessary (no find_package() consumer
downstream). Both are now handled directly, so the override and the
ROOT_BUILTINS list can be removed.

This makes ROOT compatible with vcpkg and other dependency providers
without changing behaviour: in builtin builds LLVM is still built without
zlib/zstd, and a system build is unaffected since find_package() is no
longer shadowed.

Closes root-project#8633.

🤖 Done with the help of AI, which suggested an initial solution that I
refined.

@hageboeck hageboeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens to llvm if zlib is disabled? Does it have any consequences?

@guitargeek

Copy link
Copy Markdown
Contributor Author

Good question! I assumed it's unable to compress modules then, for example. Maybe @hahnjo knows?

@guitargeek guitargeek merged commit 9d2d5f7 into root-project:master Jun 17, 2026
69 of 90 checks passed
@guitargeek guitargeek deleted the issue-8633 branch June 17, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖AI-Assisted clean build Ask CI to do non-incremental build on PR in:Build System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't replace CMake's find_package

4 participants