CMake: Use CMake 3.12 FindPython, where available

This commit is contained in:
Sam Edwards 2018-10-05 14:59:58 -06:00
parent 0997c6b19c
commit 10b5c9f3e6

View File

@ -5,16 +5,25 @@
set(WANT_PYTHON_VERSION ""
CACHE STRING "Which Python version to seek out for building Panda3D against.")
find_package(Python ${WANT_PYTHON_VERSION} QUIET COMPONENTS Interpreter Development)
if(Python_FOUND)
set(PYTHON_FOUND ON)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
else()
find_package(PythonInterp ${WANT_PYTHON_VERSION} QUIET)
find_package(PythonLibs ${PYTHON_VERSION_STRING} QUIET)
if(PYTHONLIBS_FOUND)
set(PYTHON_FOUND ON)
endif()
endif()
package_option(PYTHON DEFAULT ON
package_option(PYTHON
DEFAULT ON
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
is also enabled, Python bindings will be generated.")
is also enabled, Python bindings will be generated."
IMPORTED_AS Python::Python)
# Also detect the optimal install paths:
if(HAVE_PYTHON)