COMP: Skip dot-directories when scanning for ITK modules - #6709
Open
hjmjohnson wants to merge 1 commit into
Open
COMP: Skip dot-directories when scanning for ITK modules#6709hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
GLOB_RECURSE matches itk-module.cmake at any depth, so a nested source tree under a dot-directory is absorbed as a set of duplicate modules. Dot-directories hold tool state by convention -- git worktrees, editor and agent directories, and environment or cache trees such as the in-source .pixi directory created by ITK's own build tooling -- and .gitignore already declares several of them non-source. One affected tree reported 984 modules where 204 exist, and failed building the stale duplicates.
hjmjohnson
force-pushed
the
comp-module-scan-skip-dot-dirs
branch
from
July 26, 2026 15:52
1be0e9a to
c20bdff
Compare
hjmjohnson
marked this pull request as ready for review
July 26, 2026 16:03
Contributor
|
| Filename | Overview |
|---|---|
| CMake/ITKModuleEnablement.cmake | Adds a correctly scoped path-component filter to module discovery; no supported module layout or remote-module destination is excluded. |
Reviews (1): Last reviewed commit: "COMP: Skip dot-directories when scanning..." | Re-trigger Greptile
dzenanz
reviewed
Jul 26, 2026
dzenanz
left a comment
Member
There was a problem hiding this comment.
LGTM, it would be good if someone else reviewed too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
itk_module_load_dag()usesGLOB_RECURSE, which matchesitk-module.cmakeat any depth. Any nested source tree under the ITK checkout is therefore absorbed as a set of duplicate modules and built as if it were part of the project.Nesting a second tree inside a project is a widespread convention, and it almost always lives under a dot-directory. On one affected workstation this produced 984 discovered modules where 204 exist, and the duplicates broke the build outright.
Why dot-directories, specifically
Dot-directories are the near-universal convention for content that is not project source: version-control internals, tool and editor state, language environments, and caches. A checkout of ITK — or of anything containing
*/*/*/itk-module.cmake— commonly ends up inside one:git worktreetrees.worktrees/<branch>/, or a tool-managed directory.vscode/,.idea/,.vs/, and similar.pixi/,.venv/,.tox/,.conda/.cache/,.ExternalData/This is not hypothetical for ITK. ITK's own documented build tool creates
.pixi/inside the source tree — 3.3 GB on the machine where this was found — and.gitignorealready declares.pixiand.ideaas non-source. The module scan simply does not honor the same convention that the rest of the project already assumes.The failure is also easy to misread, because the duplicates are built against the outer tree's configuration. A nested checkout on an older branch fails in ways that look like a defect in the tree you are actually working on:
The path is the giveaway, but it is easy to miss in a full log, and
ninjastops there — a plainninjain that tree could not complete.Fix
Scoped deliberately narrowly:
ITK.Something) are unaffected.RELATIVE "${ITK_SOURCE_DIR}", so an ITK checkout that itself lives under a dot-path (/home/user/.cache/src/ITK) is unaffected — the absolute prefix is stripped before matching.itk-module.cmakeunder any dot-directory, so nothing in-project is excluded.Validation
Verified on a tree containing four nested checkouts:
Modules/Remote/*retainedBehavioral check with
ITK_FUTURE_LEGACY_REMOVE=ON,ITK_LEGACY_REMOVE=ON,Module_ITKReview=ON, 10 remote modules enabled:ninja -k 0failedninja -k 0exits 0 with zero failuresHad the filter dropped a real module, that build would have failed to link.
Remote modules are unaffected
In-tree: remotes are always fetched to
${ITK_SOURCE_DIR}/Modules/Remote/${_name}(CMake/ITKModuleRemote.cmake), a path the regex cannot match. All 10 enabled remotes are retained above.Standalone: a remote module built on its own against an installed ITK never reaches this code.
ITKModuleEnablementis included only from ITK's top-levelCMakeLists.txtand is not installed for downstream consumers, so a module usingfind_package(ITK REQUIRED)+itk_module_impl()never callsitk_module_load_dag().