5 # https://cmake.org/cmake/help/latest/module/FindPythonInterp.html
6 # https://cmake.org/cmake/help/latest/module/FindPythonLibs.html
7 # https://cmake.org/cmake/help/latest/module/FindPython.html
12 # This module defines the following variables:
16 # ``Python_EXECUTABLE``
18 # ``Python_INCLUDE_DIRS``
20 # ``Python_LIBRARIES``
24 # ``Python_VERSION_MAJOR``
26 # ``Python_VERSION_MINOR``
28 # ``Python_VERSION_PATCH``
30 if(CMAKE_VERSION VERSION_LESS 3.12)
31 set(PythonInterp_FIND_VERSION ${Python_FIND_VERSION})
32 include(${CMAKE_ROOT}/Modules/FindPythonInterp.cmake)
33 list(FIND Python_FIND_COMPONENTS Development Python_FOUND)
34 if(${Python_FOUND} GREATER -1)
35 list(INSERT Python_ADDITIONAL_VERSIONS 0 "${Python_FIND_VERSION}")
36 list(INSERT Python_ADDITIONAL_VERSIONS 0 ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
37 include(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
38 set(Python_Development_FOUND ${PYTHONLIBS_FOUND})
39 set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
40 set(Python_LIBRARIES ${PYTHON_LIBRARIES})
42 set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
43 set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR})
44 set(Python_VERSION_PATCH ${PYTHON_VERSION_PATCH})
45 set(Python_VERSION ${PYTHON_VERSION_STRING})
46 set(Python_EXECUTABLE ${PYTHON_EXECUTABLE})
47 set(Python_FOUND ${PYTHONINTERP_FOUND})
49 include(${CMAKE_ROOT}/Modules/FindPython.cmake)