Files

92 lines
3.3 KiB
Diff

Replace find_package(PythonInterp) with find_package(Python) to be able to pinpoint Python root.
--- Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/cmake/internal_utils.cmake.orig
+++ Modules/ThirdParty/GoogleTest/src/itkgoogletest/googletest/cmake/internal_utils.cmake
@@ -215,7 +215,9 @@
endfunction()
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
-find_package(PythonInterp)
+find_package(Python COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
+set(PYTHONINTERP_FOUND "${Python_Interpreter_FOUND}")
# cxx_test_with_flags(name cxx_flags libs srcs...)
#
--- CMake/ITKModuleHeaderTest.cmake.orig
+++ CMake/ITKModuleHeaderTest.cmake
@@ -6,7 +6,8 @@
# This does not force the developer to install python to be able to build ITK.
# The tests will simply not be run if python is unavailable.
-find_package(PythonInterp)
+find_package(Python COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
# Improve performance of MSVC GUI, by reducing number of header tests.
set( MAXIMUM_NUMBER_OF_HEADERS_default 35 )
@@ -30,7 +31,6 @@
if( NOT ${_name}_THIRD_PARTY
AND EXISTS ${${_name}_SOURCE_DIR}/include
AND PYTHON_EXECUTABLE
- AND NOT (PYTHON_VERSION_STRING VERSION_LESS 2.6)
AND NOT (${_name} STREQUAL ITKTestKernel)
AND NOT (CMAKE_GENERATOR MATCHES "^Visual Studio 10.*"))
--- CMake/ITKModuleDoxygen.cmake.orig
+++ CMake/ITKModuleDoxygen.cmake
@@ -6,7 +6,8 @@
# python is needed to verify the presence of the module name in the doxygen header
# Don't require it to not force the developers to install python to be able to build
# ITK. The tests will simply not be run if python is not available.
-find_package(PythonInterp)
+find_package(Python COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
macro( itk_module_doxygen _name )
--- Wrapping/Generators/Python/CMakeLists.txt.orig
+++ Wrapping/Generators/Python/CMakeLists.txt
@@ -1,18 +1,7 @@
###############################################################################
# configure python (find PythonInterp first, as of cmake 3.1)
-find_package(PythonInterp)
-find_package(ITKPythonLibs)
-
-# require at least python 2.6
-if(PYTHON_VERSION_STRING VERSION_LESS 2.6)
- message(WARNING "Python version less than 2.6: \"${PYTHON_VERSION_STRING}\".")
-endif()
-
-# check for version mismatch.
-if(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND
- AND NOT(PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING))
- message(WARNING "Python executable (\"${PYTHON_VERSION_STRING}\") and library (\"${PYTHONLIBS_VERSION_STRING}\") version mismatch.")
-endif()
+find_package(Python COMPONENTS Interpreter REQUIRED)
+set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
if(NOT EXTERNAL_WRAP_ITK_PROJECT)
CMAKE_DEPENDENT_OPTION(ITK_WRAP_PYTHON_LEGACY "Build Legacy Python support." ON
--- Wrapping/Generators/SwigInterface/CMakeLists.txt.orig
+++ Wrapping/Generators/SwigInterface/CMakeLists.txt
@@ -8,7 +8,9 @@
###############################################################################
# Find python
-find_package(PythonInterp REQUIRED)
+find_package(Python COMPONENTS Interpreter REQUIRED)
+set(PYTHONINTERP_FOUND "${Python_Interpreter_FOUND}")
+set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
###############################################################################
# Build swig