Skip to content

COMP: Move CMake's include(ITKWindowsUtf8) for external modules#6244

Merged
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
SimonRit:utf8
May 9, 2026
Merged

COMP: Move CMake's include(ITKWindowsUtf8) for external modules#6244
hjmjohnson merged 1 commit intoInsightSoftwareConsortium:mainfrom
SimonRit:utf8

Conversation

@SimonRit
Copy link
Copy Markdown

@SimonRit SimonRit commented May 9, 2026

The inclusion in the root CMakeLists.txt was causing the following configure error when compiling a module externally:

CMake Error at C:/src/itk/ITK-main/CMake/ITKModuleTest.cmake:93 (itk_target_attach_windows_utf8_manifest):
  Unknown CMake command "itk_target_attach_windows_utf8_manifest".
Call Stack (most recent call first):
  test/CMakeLists.txt:22 (createtestdriver)

See e.g. https://my.cdash.org/builds/3530626/configure.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

The inclusion in the root CMakeLists.txt was causing the following
configure error when compiling a module externally:

```
CMake Error at C:/src/itk/ITK-main/CMake/ITKModuleTest.cmake:93 (itk_target_attach_windows_utf8_manifest):
  Unknown CMake command "itk_target_attach_windows_utf8_manifest".
Call Stack (most recent call first):
  test/CMakeLists.txt:22 (createtestdriver)
```
@github-actions github-actions Bot added type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots labels May 9, 2026
@SimonRit
Copy link
Copy Markdown
Author

SimonRit commented May 9, 2026

Caused by #6209 @hjmjohnson.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 9, 2026

Greptile Summary

This PR fixes a configure-time error for external ITK modules on Windows by moving include(ITKWindowsUtf8) from the root CMakeLists.txt into CMake/ITKModuleTest.cmake, where the itk_target_attach_windows_utf8_manifest function it defines is actually consumed.

  • CMakeLists.txt: Removes the top-level include(ITKWindowsUtf8) that was previously defined before include(ITKModuleTest).
  • CMake/ITKModuleTest.cmake: Adds include(ITKWindowsUtf8) at the top of the file so the itk_target_attach_windows_utf8_manifest command is always available whenever this module is included, including from external module builds that never process the root CMakeLists.txt.

Confidence Score: 5/5

Safe to merge; the change is minimal and correctly targets the root cause of the Windows external-module configure failure.

Moving the include into ITKModuleTest.cmake ensures itk_target_attach_windows_utf8_manifest is always defined when it is called, both for in-tree builds and external module builds. The only other direct caller, Modules/Core/TestKernel/src/CMakeLists.txt, is always processed after the root include chain, so it continues to work. ITKWindowsUtf8.cmake uses CMAKE_CURRENT_LIST_DIR internally, which always resolves to its own directory regardless of who includes it, so the manifest path remains correct.

No files require special attention.

Important Files Changed

Filename Overview
CMakeLists.txt Removes the now-redundant top-level include(ITKWindowsUtf8); the include is now co-located with its user in ITKModuleTest.cmake and will still be processed before any module source CMakeLists.txt in both in-tree and external builds.
CMake/ITKModuleTest.cmake Adds include(ITKWindowsUtf8) at file scope so itk_target_attach_windows_utf8_manifest is always defined when CreateTestDriver or CreateGoogleTestDriver call it, fixing the Unknown CMake command error for external module builds.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Root CMakeLists.txt] -->|include| B[ITKModuleMacros]
    A -->|include| C[ITKExternalData]
    A -->|include| D[ITKModuleTest.cmake]
    D -->|include| E[ITKWindowsUtf8.cmake]
    E -->|defines| F[itk_target_attach_windows_utf8_manifest]
    D -->|defines| G[CreateTestDriver]
    D -->|defines| H[CreateGoogleTestDriver]
    G -->|calls| F
    H -->|calls| F
    I[External Module Build] -->|include| D
    J[Modules/Core/TestKernel/src/CMakeLists.txt] -->|calls directly| F
    style E fill:#90EE90
    style F fill:#90EE90
Loading

Reviews (1): Last reviewed commit: "COMP: Move CMake's include(ITKWindowsUtf..." | Re-trigger Greptile

Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

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

Thank you @SimonRit

@hjmjohnson hjmjohnson merged commit 0997958 into InsightSoftwareConsortium:main May 9, 2026
23 of 24 checks passed
@SimonRit SimonRit deleted the utf8 branch May 11, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants