Skip to content

BUG: Replace multi-line DESCRIPTION strings in 5 ingested itk-module.cmake#6220

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:fix-cmake-configure-warnings
May 6, 2026
Merged

BUG: Replace multi-line DESCRIPTION strings in 5 ingested itk-module.cmake#6220
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
hjmjohnson:fix-cmake-configure-warnings

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

BUG: Fix CMake configure warnings from multi-line DESCRIPTION in itk_module()

Five recently-ingested modules (RLEImage, SplitComponents, IOFDF,
IOMeshMZ3, IOMeshSTL) produce CMake Warning (dev): Unknown argument
on every configure because their itk-module.cmake reads the archival
README.md into a DESCRIPTION argument and the README contains
semicolons and [ characters that CMake list expansion splits into
spurious arguments.

Root cause

CMake/ITKModuleMacros.cmake used foreach(arg ${ARGN}) to iterate
over itk_module() arguments. When DESCRIPTION holds a multi-line
string with semicolons, CMake expands ${ARGN} and re-splits on ;
before iteration, so each semicolon-delimited fragment becomes a
separate loop element and hits the "Unknown argument" warning.

Two complementary fixes:

  1. ITKModuleMacros.cmakeforeach(arg IN LISTS ARGN) iterates
    the actual list elements without re-splitting. This is a safety net
    for any DESCRIPTION that contains semicolons.

  2. Five itk-module.cmake files — replace the
    get_filename_component / file(READ README.md DOCUMENTATION) preamble
    and DESCRIPTION "${DOCUMENTATION}" with a static one-liner. The
    archival README.md (a migration notice) is not meaningful module
    documentation and should not be the source of CMake metadata.

Affected modules and CDash evidence

All 12 configure warnings on the latest Mac nightly build trace to
ITKModuleMacros.cmake:111 via message(AUTHOR_WARNING "Unknown argument [${arg}]").

Module README semicolons README [ chars
RLEImage 3 2
SplitComponents 4 2
IOFDF 3 2
IOMeshMZ3 3 2
IOMeshSTL 1 1

A companion fix to PR #6204 (sanitize-history.py) adds
patch_dynamic_description() so future ingests never introduce the
pattern.

@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module labels May 6, 2026
…cmake

Five recently-ingested remote modules used the historical pattern of
loading README.md content into a CMake DOCUMENTATION variable and
passing it to itk_module() via DESCRIPTION "${DOCUMENTATION}".  The
multi-line README content contains markdown bullet syntax with
semicolons that CMake's argument-tokenizer treats as list separators,
which produces 'Unknown argument' configure-time warnings as the
itk_module() macro's argument parser reads the chunks as separate
tokens rather than a single description string.

Replace the README-loading pattern in these five modules with a
hardcoded one-line DESCRIPTION:

  Modules/Filtering/RLEImage/itk-module.cmake
  Modules/Filtering/SplitComponents/itk-module.cmake
  Modules/IO/IOFDF/itk-module.cmake
  Modules/IO/IOMeshMZ3/itk-module.cmake
  Modules/IO/IOMeshSTL/itk-module.cmake

The README files themselves are unchanged and remain the canonical
source of human-readable module documentation.  Other in-tree modules
still using the file(READ DOCUMENTATION) + DESCRIPTION "${DOCUMENTATION}"
pattern are out of scope for this PR; they may be migrated in
follow-ups so the corresponding itk_module() macro tweak (foreach IN
LISTS ARGN) can land cleanly.
@hjmjohnson hjmjohnson force-pushed the fix-cmake-configure-warnings branch from 77c477b to fe40592 Compare May 6, 2026 17:31
@hjmjohnson hjmjohnson changed the title BUG: Fix CMake configure warnings from multi-line DESCRIPTION in itk_module() BUG: Replace multi-line DESCRIPTION strings in 5 ingested itk-module.cmake May 6, 2026
@hjmjohnson
Copy link
Copy Markdown
Member Author

Force-pushed 77c477b82f → fe40592ff5 after rebasing onto current upstream/main (was 4 commits behind) and dropping the foreach(arg IN LISTS ARGN) macro change. Now scope is the README-cleanup only across 5 ingested modules; configure verified clean locally (Ubuntu 24.04 / cmake 4.2.1 / ITK_BUILD_DEFAULT_MODULES=ON).

Why the macro change was dropped

The original PR also tweaked CMake/ITKModuleMacros.cmake:72 from foreach(arg ${ARGN}) to foreach(arg IN LISTS ARGN). Local repro showed this produced configure-time CMake Generate step failed errors of the form:

Target "AnisotropicDiffusionLBRHeaderTest1" links to:
  ITK::ITKKWSysModule
but the target was not found.

across every recently-ingested module's HeaderTest. Root cause: the IN LISTS ARGN form does not undergo CMake's argument-tokenizer re-splitting, so when other in-tree modules (AnisotropicDiffusionLBR, MorphologicalContourInterpolation, RLEImage at the time of call, etc.) still pass multi-line ${DOCUMENTATION} to DESCRIPTION, the IN-LISTS iteration treats README chunks as separate "Unknown argument" tokens. The macro's parser hits its else branch and resets _doing="", corrupting the state machine so subsequent legitimate DEPENDS/TEST_DEPENDS keywords stop being parsed correctly.

The macro tweak can land cleanly only after every itk-module.cmake in the tree has stopped passing multi-line ${DOCUMENTATION} to DESCRIPTION. This PR migrates 5 of them; the remaining ones (AnisotropicDiffusionLBR, FastBilateral, IOMGH, LabelErodeDilate, MeshNoise, Montage, MorphologicalContourInterpolation, …) need parallel migration in a follow-up before the foreach IN LISTS change is safe.

Verification
Configuration Pure upstream/main upstream/main + foreach-only-patch upstream/main + this PR (fe40592ff5)
Configure ✅ clean ❌ "Unknown argument" warnings + ITKKWSysModule error ✅ clean

Local cmake 4.2.1 / gcc 13.3 / Ubuntu 24.04, full default modules enabled (ITKVideoBridgeOpenCV excluded due to local missing OpenCV; not PR-related).

@github-actions github-actions Bot removed the type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots label May 6, 2026
@hjmjohnson hjmjohnson marked this pull request as ready for review May 6, 2026 18:54
@greptile-apps

This comment was marked as resolved.

Comment thread Modules/Filtering/RLEImage/itk-module.cmake
@hjmjohnson hjmjohnson merged commit 6443ee3 into InsightSoftwareConsortium:main May 6, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants