Skip to content

Commit e35c836

Browse files
committed
COMP: Build itkPyCommand.cxx against Python3::SABIModule
The Python3::Module fallback was reachable only without the limited API. A missing SABIModule target is now an explicit configure error rather than a silent downgrade.
1 parent 12f1368 commit e35c836

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Modules/Core/Common/src/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,19 @@ set(
162162
)
163163

164164
if(ITK_WRAP_PYTHON)
165-
if(ITK_USE_PYTHON_LIMITED_API AND TARGET Python3::SABIModule)
166-
set(_itk_python_target Python3::SABIModule)
167-
else()
168-
set(_itk_python_target Python3::Module)
165+
if(NOT TARGET Python3::SABIModule)
166+
message(
167+
FATAL_ERROR
168+
"ITK_WRAP_PYTHON=ON requires the Python3 Development.SABIModule component, "
169+
"but the Python3::SABIModule target was not defined."
170+
)
169171
endif()
170172
list(APPEND ITKCommon_SRCS itkPyCommand.cxx)
171173
set_source_files_properties(
172174
itkPyCommand.cxx
173175
PROPERTIES
174176
INCLUDE_DIRECTORIES
175-
"$<TARGET_PROPERTY:${_itk_python_target},INTERFACE_INCLUDE_DIRECTORIES>"
177+
"$<TARGET_PROPERTY:Python3::SABIModule,INTERFACE_INCLUDE_DIRECTORIES>"
176178
)
177179
endif()
178180

0 commit comments

Comments
 (0)