Skip to content

Commit 603a172

Browse files
hjmjohnsonlassoan
authored andcommitted
COMP: Update to newer find_package(Python3) support
The Python3 cmake find_package module was first added in version 3.12 This module provides more rigorous support for specifying the exact version and components that are needed. The module has refinements in newer cmake versions to limit the version and specify the ABI required.
1 parent 84c1a4d commit 603a172

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CMake/vtkMacroKitPythonWrap.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ macro(vtkMacroKitPythonWrap)
160160

161161
if(VTK_WRAP_PYTHON AND BUILD_SHARED_LIBS)
162162

163-
# Tell vtkWrapPython.cmake to set VTK_PYTHON_LIBRARIES for us.
163+
# Tell vtkWrapPython.cmake to set VTK_Python3_LIBRARIES for us.
164164
set(VTK_WRAP_PYTHON_FIND_LIBS 1)
165165
include(vtkWrapPython)
166166

@@ -283,7 +283,7 @@ macro(vtkMacroKitPythonWrap)
283283
${MY_KIT_NAME}PythonD
284284
${MY_KIT_NAME}
285285
${VTK_PYTHON_CORE}
286-
${VTK_PYTHON_LIBRARIES}
286+
${VTK_Python3_LIBRARIES}
287287
${VTK_KIT_PYTHON_LIBRARIES}
288288
${MY_KIT_PYTHON_LIBRARIES}
289289
)
@@ -344,7 +344,7 @@ macro(vtkMacroKitPythonWrap)
344344
target_link_libraries(${MY_KIT_NAME}Python
345345
PRIVATE
346346
${MY_KIT_NAME}
347-
${VTK_PYTHON_LIBRARIES}
347+
${VTK_Python3_LIBRARIES}
348348
VTK::WrappingPythonCore
349349
VTK::Python
350350
)

CMake/vtkWrapPython.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ if(VTK_WRAP_PYTHON_FIND_LIBS)
189189
else()
190190
set(_QUIET_LIBRARY "REQUIRED")
191191
endif()
192-
find_package(PythonLibs ${_QUIET_LIBRARY})
192+
find_package(Python3 COMPONENTS Development ${_QUIET_LIBRARY})
193193

194194
# Use separate debug/optimized libraries if they are different.
195195
if(PYTHON_DEBUG_LIBRARY)
196196
if("${PYTHON_DEBUG_LIBRARY}" STREQUAL "${PYTHON_LIBRARY}")
197-
set(VTK_PYTHON_LIBRARIES ${PYTHON_LIBRARY})
197+
set(VTK_Python3_LIBRARIES ${PYTHON_LIBRARY})
198198
else()
199-
set(VTK_PYTHON_LIBRARIES
199+
set(VTK_Python3_LIBRARIES
200200
optimized ${PYTHON_LIBRARY}
201201
debug ${PYTHON_DEBUG_LIBRARY})
202202
endif()
@@ -207,7 +207,7 @@ if(VTK_WRAP_PYTHON_FIND_LIBS)
207207
endif()
208208
endif()
209209
else()
210-
set(VTK_PYTHON_LIBRARIES ${PYTHON_LIBRARY})
210+
set(VTK_Python3_LIBRARIES ${PYTHON_LIBRARY})
211211
endif()
212212

213213
# Some python installations on UNIX need to link to extra libraries
@@ -224,7 +224,7 @@ if(VTK_WRAP_PYTHON_FIND_LIBS)
224224
endif()
225225

226226
# Include any extra libraries for python.
227-
set(VTK_PYTHON_LIBRARIES ${VTK_PYTHON_LIBRARIES} ${PYTHON_EXTRA_LIBS})
227+
set(VTK_Python3_LIBRARIES ${VTK_Python3_LIBRARIES} ${PYTHON_EXTRA_LIBS})
228228
endif()
229229

230230
# Determine the location of the supplied header in the include_dirs supplied.

0 commit comments

Comments
 (0)