Skip to content

Windows Python CMake configuration fixes#5854

Open
thewtex wants to merge 2 commits intoInsightSoftwareConsortium:releasefrom
thewtex:win-find-python
Open

Windows Python CMake configuration fixes#5854
thewtex wants to merge 2 commits intoInsightSoftwareConsortium:releasefrom
thewtex:win-find-python

Conversation

@thewtex
Copy link
Member

@thewtex thewtex commented Mar 3, 2026

A few fixes for the CMake Python configuration to address the Windows ITKPythonPackage build.

thewtex added 2 commits March 1, 2026 20:59
When ITK_USE_PYTHON_LIMITED_API is ON (Python >= 3.11), the second
find_package(Python3) call only requested Development.SABIModule, never
creating the Python3::Module target. ITKCommon unconditionally referenced
Python3::Module, causing a CMake generate-time error.

- Always request Development.Module alongside Development.SABIModule so the
  Python3::Module target is created regardless of limited API setting
- Select Python3::SABIModule or Python3::Module in ITKCommon based on
  ITK_USE_PYTHON_LIMITED_API for architecturally correct linking
- Extend Python3_ROOT_DIR inference to Windows (was Unix/Apple only)
  so FindPython3 locates the correct installation from virtualenvs
On Windows, we need to specify the link directory for python311.lib.

This is for building the ITKPythonPackage after recent target-based
build system and CMake find python changes.
@github-actions github-actions bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Python wrapping Python bindings for a class area:Core Issues affecting the Core module labels Mar 3, 2026
@thewtex thewtex added this to the ITK 6.0 Beta 2 milestone Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module area:Python wrapping Python bindings for a class type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant