mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 19:49:51 +00:00
Python additional version support, bug #10279.
Introduced an additional variable, Python_ADDITIONAL_VERSIONS, to both FindPythonLibs and FindPythonInterp. Changed FindPythonInterp to loop over versions rather than hardcoding all versions (more like libs).
This commit is contained in:
parent
6754b26bf0
commit
2d3594b1bb
@ -4,6 +4,7 @@
|
||||
#
|
||||
# PYTHONINTERP_FOUND - Was the Python executable found
|
||||
# PYTHON_EXECUTABLE - path to the Python interpreter
|
||||
# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
@ -19,25 +20,32 @@
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
FIND_PROGRAM(PYTHON_EXECUTABLE
|
||||
NAMES python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
set(_Python_VERSIONS
|
||||
${Python_ADDITIONAL_VERSIONS}
|
||||
2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
||||
|
||||
# Run first with the Python version in the executable
|
||||
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
set(_Python_NAMES python${_CURRENT_VERSION})
|
||||
if(WIN32)
|
||||
list(APPEND _Python_NAMES python)
|
||||
endif()
|
||||
find_program(PYTHON_EXECUTABLE
|
||||
NAMES ${_Python_NAMES}
|
||||
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
|
||||
)
|
||||
endforeach()
|
||||
# Now without any version if we still haven't found it
|
||||
if(NOT PYTHON_EXECUTABLE)
|
||||
find_program(PYTHON_EXECUTABLE NAMES python)
|
||||
endif()
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp DEFAULT_MSG PYTHON_EXECUTABLE)
|
||||
|
||||
MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
|
||||
|
||||
mark_as_advanced(PYTHON_EXECUTABLE)
|
||||
|
@ -8,7 +8,7 @@
|
||||
# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
|
||||
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
|
||||
# PYTHON_DEBUG_LIBRARIES - path to the debug library
|
||||
#
|
||||
# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
@ -27,7 +27,13 @@ INCLUDE(CMakeFindFrameworks)
|
||||
# Search for the python framework on Apple.
|
||||
CMAKE_FIND_FRAMEWORKS(Python)
|
||||
|
||||
FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
||||
# Set up the versions we know about, in the order we will search. Always add
|
||||
# the user supplied additional versions to the front.
|
||||
set(_Python_VERSIONS
|
||||
${Python_ADDITIONAL_VERSIONS}
|
||||
2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
||||
|
||||
FOREACH(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||
STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY(PYTHON_DEBUG_LIBRARY
|
||||
|
Loading…
Reference in New Issue
Block a user