mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-11 20:11:10 -05:00
FindPython*: fix erroneous handling of virtual environments
fixes: #18408
This commit is contained in:
@@ -135,6 +135,12 @@ Hints
|
|||||||
|
|
||||||
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If a Python virtual environment is configured, set variable
|
||||||
|
``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with
|
||||||
|
value ``LAST`` or ``NEVER`` to select it preferably.
|
||||||
|
|
||||||
Commands
|
Commands
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@@ -355,20 +355,23 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
|
|||||||
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
|
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
|
||||||
NAMES_PER_DIR
|
NAMES_PER_DIR
|
||||||
HINTS ${_${_PYTHON_PREFIX}_HINTS}
|
HINTS ${_${_PYTHON_PREFIX}_HINTS}
|
||||||
PATH_SUFFIXES bin
|
PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
|
||||||
NO_SYSTEM_ENVIRONMENT_PATH
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
NO_CMAKE_SYSTEM_PATH)
|
NO_CMAKE_SYSTEM_PATH)
|
||||||
# try using standard paths.
|
# try using standard paths.
|
||||||
# NAMES_PER_DIR is not defined on purpose to have a chance to find
|
if (WIN32)
|
||||||
# expected version.
|
find_program (${_PYTHON_PREFIX}_EXECUTABLE
|
||||||
# For example, typical systems have 'python' for version 2.* and 'python3'
|
NAMES python${_${_PYTHON_PREFIX}_VERSION}
|
||||||
# for version 3.*. So looking for names per dir will find, potentially,
|
python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
|
||||||
# systematically 'python' (i.e. version 2) even if version 3 is searched.
|
python
|
||||||
find_program (${_PYTHON_PREFIX}_EXECUTABLE
|
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
|
||||||
NAMES python${_${_PYTHON_PREFIX}_VERSION}
|
NAMES_PER_DIR)
|
||||||
python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
|
else()
|
||||||
python
|
find_program (${_PYTHON_PREFIX}_EXECUTABLE
|
||||||
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES})
|
NAMES python${_${_PYTHON_PREFIX}_VERSION}
|
||||||
|
python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
|
||||||
|
NAMES_PER_DIR)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Apple frameworks handling
|
# Apple frameworks handling
|
||||||
if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
|
if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "LAST")
|
||||||
@@ -413,6 +416,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
|
|||||||
NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
|
NAMES python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}
|
||||||
python
|
python
|
||||||
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
|
${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}
|
||||||
|
NAMES_PER_DIR
|
||||||
HINTS ${_${_PYTHON_PREFIX}_HINTS}
|
HINTS ${_${_PYTHON_PREFIX}_HINTS}
|
||||||
PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
|
PATH_SUFFIXES bin ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}
|
||||||
NO_SYSTEM_ENVIRONMENT_PATH
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ Hints
|
|||||||
|
|
||||||
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If a Python virtual environment is configured, set variable
|
||||||
|
``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with
|
||||||
|
value ``LAST`` or ``NEVER`` to select it preferably.
|
||||||
|
|
||||||
Commands
|
Commands
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ Hints
|
|||||||
|
|
||||||
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If a Python virtual environment is configured, set variable
|
||||||
|
``Python_FIND_REGISTRY`` (Windows) or ``CMAKE_FIND_FRAMEWORK`` (macOS) with
|
||||||
|
value ``LAST`` or ``NEVER`` to select it preferably.
|
||||||
|
|
||||||
Commands
|
Commands
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user