Commit 3a71c65
committed
[CMake] Don't override find_package() for builtins
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 (#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:
* ZLIB (used by core/zip's find_package(ZLIB REQUIRED) and the
transitive FindPNG -> find_package(ZLIB) of the asimage build):
builtins/zlib pre-seeds the singular cache variables ZLIB_LIBRARY
and ZLIB_INCLUDE_DIR that FindZLIB.cmake checks, so find_package()
short-circuits to the builtin and keeps the ZLIB::ZLIB target. This
also avoids the "FORCE specified without CACHE" error from
select_library_configurations() that a real FindPNG -> FindZLIB
chain would otherwise hit.
* zstd (used only by the bundled LLVM): interpreter/CMakeLists.txt sets
LLVM_ENABLE_ZSTD=OFF (and LLVM_ENABLE_ZLIB=OFF) for builtin builds,
so LLVM never searches for the system copy. We can't point LLVM at
the builtins instead, as it probes them with a configure-time
compile/link check that the not-yet-built ExternalProject can't pass
anyway.
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 #8633.
🤖 Done with the help of [Claude Code](https://claude.com/claude-code) (Claude Opus 4.8)1 parent 936b7b2 commit 3a71c65
3 files changed
Lines changed: 22 additions & 25 deletions
File tree
- builtins/zlib
- cmake/modules
- interpreter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 140 | | |
149 | 141 | | |
150 | 142 | | |
| |||
160 | 152 | | |
161 | 153 | | |
162 | 154 | | |
163 | | - | |
164 | 155 | | |
165 | 156 | | |
166 | 157 | | |
| |||
216 | 207 | | |
217 | 208 | | |
218 | 209 | | |
219 | | - | |
220 | 210 | | |
221 | 211 | | |
222 | 212 | | |
| |||
259 | 249 | | |
260 | 250 | | |
261 | 251 | | |
262 | | - | |
263 | 252 | | |
264 | 253 | | |
265 | 254 | | |
| |||
299 | 288 | | |
300 | 289 | | |
301 | 290 | | |
302 | | - | |
303 | 291 | | |
304 | 292 | | |
305 | 293 | | |
306 | 294 | | |
307 | | - | |
308 | 295 | | |
309 | 296 | | |
310 | 297 | | |
311 | 298 | | |
312 | 299 | | |
313 | | - | |
314 | 300 | | |
315 | 301 | | |
316 | 302 | | |
| |||
320 | 306 | | |
321 | 307 | | |
322 | 308 | | |
323 | | - | |
324 | | - | |
325 | 309 | | |
326 | 310 | | |
327 | 311 | | |
328 | 312 | | |
329 | 313 | | |
330 | | - | |
331 | 314 | | |
332 | 315 | | |
333 | 316 | | |
| |||
482 | 465 | | |
483 | 466 | | |
484 | 467 | | |
485 | | - | |
486 | 468 | | |
487 | 469 | | |
488 | 470 | | |
| |||
550 | 532 | | |
551 | 533 | | |
552 | 534 | | |
553 | | - | |
554 | 535 | | |
555 | 536 | | |
556 | 537 | | |
| |||
619 | 600 | | |
620 | 601 | | |
621 | 602 | | |
622 | | - | |
623 | 603 | | |
624 | 604 | | |
625 | 605 | | |
| |||
713 | 693 | | |
714 | 694 | | |
715 | 695 | | |
716 | | - | |
717 | 696 | | |
718 | 697 | | |
719 | 698 | | |
| |||
780 | 759 | | |
781 | 760 | | |
782 | 761 | | |
783 | | - | |
784 | 762 | | |
785 | 763 | | |
786 | 764 | | |
| |||
940 | 918 | | |
941 | 919 | | |
942 | 920 | | |
943 | | - | |
944 | 921 | | |
945 | 922 | | |
946 | 923 | | |
| |||
969 | 946 | | |
970 | 947 | | |
971 | 948 | | |
972 | | - | |
973 | 949 | | |
974 | 950 | | |
975 | 951 | | |
| |||
1129 | 1105 | | |
1130 | 1106 | | |
1131 | 1107 | | |
1132 | | - | |
1133 | 1108 | | |
1134 | 1109 | | |
1135 | 1110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
24 | 36 | | |
25 | 37 | | |
26 | 38 | | |
| |||
0 commit comments