diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-09-04 14:26:26 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2018-09-12 08:04:04 (GMT) |
commit | b0b53921cef242acc91e6ab4dd495daff54191d6 (patch) | |
tree | 972ad33bd8b5f8bd90e0de8e50516248365f3f43 /Modules/FindPython | |
parent | f53bd80de17546351a635a47434b2ac66b4100a7 (diff) | |
download | CMake-b0b53921cef242acc91e6ab4dd495daff54191d6.zip CMake-b0b53921cef242acc91e6ab4dd495daff54191d6.tar.gz CMake-b0b53921cef242acc91e6ab4dd495daff54191d6.tar.bz2 |
FindPython: clean-up lookup names strategy
Diffstat (limited to 'Modules/FindPython')
-rw-r--r-- | Modules/FindPython/Support.cmake | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index fe3df91..9144ba4 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -244,7 +244,8 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) endif() # try in standard paths find_program (${_PYTHON_PREFIX}_EXECUTABLE - NAMES python${_${_PYTHON_PREFIX}_VERSION}) + NAMES python${_${_PYTHON_PREFIX}_VERSION} + NAMES_PER_DIR) _python_validate_interpreter () if (${_PYTHON_PREFIX}_EXECUTABLE) @@ -252,10 +253,15 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) endif() endforeach() - # try more generic names + # try more generic names. NAMES_PER_DIR is not specified on purpose to have a + # chance to find expected version. + # For example, typical systems have 'python' for version 2.* and 'python3' + # for version 3.*. So looking for names per dir will find, potentially, + # systematically 'python' (i.e. version 2) even if version 3 is searched. if (NOT ${_PYTHON_PREFIX}_EXECUTABLE) find_program (${_PYTHON_PREFIX}_EXECUTABLE - NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python + NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} + python ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} HINTS ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) @@ -483,6 +489,7 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS list (APPEND _${_PYTHON_PREFIX}_CONFIG_NAMES "python${_${_PYTHON_PREFIX}_VERSION}-config") find_program (_${_PYTHON_PREFIX}_CONFIG NAMES ${_${_PYTHON_PREFIX}_CONFIG_NAMES} + NAMES_PER_DIR HINTS ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) unset (_${_PYTHON_PREFIX}_CONFIG_NAMES) |