BUG: Fix check for including old cmake documentation code#6248
Conversation
|
@hjmjohnson A followup to my other work I just discovered while preparing a big build matrix of different Linux versions. |
|
| Filename | Overview |
|---|---|
| Utilities/Doxygen/CMakeLists.txt | Version threshold corrected from 4.0 to 3.18 so CMake 3.18–3.x users no longer trigger the deprecated Documentation.cmake include; a stale inline comment still references "CMake >= 4.0" as the inline cutoff. |
Reviews (1): Last reviewed commit: "BUG: Fix check for including old cmake d..." | Re-trigger Greptile
| # (preserving any auxiliary behavior it provides on era-original toolchains) | ||
| # and inline the BUILD_DOCUMENTATION option on CMake >= 4.0 where the file | ||
| # no longer ships. |
There was a problem hiding this comment.
The block comment above the condition still says "CMake >= 4.0 where the file no longer ships," but with this fix the inline
option() path now activates starting at 3.18. The description is now misleading for users on 3.18–3.x, where the module still ships but is deprecated.
| # (preserving any auxiliary behavior it provides on era-original toolchains) | |
| # and inline the BUILD_DOCUMENTATION option on CMake >= 4.0 where the file | |
| # no longer ships. | |
| # (preserving any auxiliary behavior it provides on era-original toolchains) | |
| # and inline the BUILD_DOCUMENTATION option on CMake >= 3.18 where the module | |
| # is deprecated (CMP0106) or no longer ships (CMake 4.0+). |
There was a problem hiding this comment.
Pull request overview
Fixes the CMake version gate in Utilities/Doxygen/CMakeLists.txt so ITK no longer includes CMake’s deprecated Documentation.cmake module for CMake versions where it triggers CMP0106 warnings (CMake 3.18+), while still supporting older CMake releases.
Changes:
- Update the version check to include
Documentation.cmakeonly for CMake< 3.18(instead of< 4.0). - Keep
BUILD_DOCUMENTATIONoption definition for newer CMake versions to avoid relying on the removed/deprecated module.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # and inline the BUILD_DOCUMENTATION option on CMake >= 4.0 where the file | ||
| # no longer ships. |
Change-Id: I4d77548f49fe01da14dbf1a4839e3d65ba0e678a
|
@gdevenyi I pushed Why drop the conditional?The old conditional + comment block (which I had authored in c157a10 and was wrong) tried to gate the legacy Once that's the rationale, the legacy branch only ever runs on CMake 3.5–3.17, and the only thing it provides that the inline path doesn't is a handful of auxiliary variables ( Final form: # CMake's Documentation.cmake (the source of BUILD_DOCUMENTATION on legacy
# toolchains) is deprecated under CMP0106 since CMake 3.18 and removed in
# CMake 4.0. Define the option directly; no auxiliary variable from that
# module is referenced in this tree.
option(BUILD_DOCUMENTATION "Build the documentation (Doxygen)." OFF) |
|
This is fine. My agent also suggested this but I always want to offer minimal change solutions. |
d72b445
into
InsightSoftwareConsortium:release-4.14
Bumps the pinned ITK release-4.14 SHA from b31208a2 (2026-05-05) to d72b4459 (2026-05-09) to incorporate the Documentation.cmake gate fix merged in InsightSoftwareConsortium/ITK#6248. Without that upstream fix, ITK 4.14's Utilities/Doxygen/CMakeLists.txt included the deprecated Modules/Documentation.cmake unconditionally on CMake versions older than 4.0, hitting CMP0106 errors on Ubuntu 22.04 (CMake 3.22), Fedora 42/43 (CMake 3.30+), and similar. The upstream patch tightens the version gate to CMake < 3.18 (when CMP0106 was introduced), restoring the ability to configure ITK 4.14 against any modern CMake without policy overrides on our side.
cmake CMP0106 was introduced in 3.18 not 4.0.
This fixes a bug for cmake versions between 3.18 and 4.0.