1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 03:48:02 +08:00

FindPython: misc. fixes

Help: Fix errors regardings HINTS.
Code: Optimize Python signature cache variable to avoid unecessary searchs.
This commit is contained in:
Marc Chevrier
2020-03-24 18:13:03 +01:00
parent c1ad4a74d4
commit bf1ecfef7f
4 changed files with 21 additions and 27 deletions

View File

@@ -191,8 +191,7 @@ Hints
``Python_FIND_STRATEGY`` ``Python_FIND_STRATEGY``
This variable defines how lookup will be done. This variable defines how lookup will be done.
The ``Python_FIND_STRATEGY`` variable can be set to empty or one of the The ``Python_FIND_STRATEGY`` variable can be set to one of the following:
following:
* ``VERSION``: Try to find the most recent version in all specified * ``VERSION``: Try to find the most recent version in all specified
locations. locations.
@@ -205,8 +204,7 @@ Hints
``Python_FIND_REGISTRY`` ``Python_FIND_REGISTRY``
On Windows the ``Python_FIND_REGISTRY`` variable determine the order On Windows the ``Python_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables. of preference between registry and environment variables.
the ``Python_FIND_REGISTRY`` variable can be set to empty or one of the the ``Python_FIND_REGISTRY`` variable can be set to one of the following:
following:
* ``FIRST``: Try to use registry before environment variables. * ``FIRST``: Try to use registry before environment variables.
This is the default. This is the default.
@@ -216,8 +214,8 @@ Hints
``Python_FIND_FRAMEWORK`` ``Python_FIND_FRAMEWORK``
On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components. preference between Apple-style and unix-style package components.
This variable can be set to empty or take same values as This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
:variable:`CMAKE_FIND_FRAMEWORK` variable. variable.
.. note:: .. note::
@@ -231,8 +229,8 @@ Hints
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it is active (i.e. the ``activate`` script has been evaluated). In this case, it
takes precedence over ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` takes precedence over ``Python_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
variables. The ``Python_FIND_VIRTUALENV`` variable can be set to empty or variables. The ``Python_FIND_VIRTUALENV`` variable can be set to one of the
one of the following: following:
* ``FIRST``: The virtual environment is used before any other standard * ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default. paths to look-up for the interpreter. This is the default.

View File

@@ -941,15 +941,15 @@ endif()
# Compute search signature # Compute search signature
# This signature will be used to check validity of cached variables on new search # This signature will be used to check validity of cached variables on new search
set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}") set (_${_PYTHON_PREFIX}_SIGNATURE "${${_PYTHON_PREFIX}_ROOT_DIR}:${_${_PYTHON_PREFIX}_FIND_STRATEGY}:${${_PYTHON_PREFIX}_FIND_VIRTUALENV}")
if (NOT WIN32) if (NOT WIN32)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:") string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_USE_STATIC_LIBS}:")
endif() endif()
if (CMAKE_HOST_APPLE) if (CMAKE_HOST_APPLE)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_FIND_FRAMEWORK}") string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${_${_PYTHON_PREFIX}_FIND_FRAMEWORK}")
endif() endif()
if (CMAKE_HOST_WIN32) if (CMAKE_HOST_WIN32)
string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${${_PYTHON_PREFIX}_FIND_REGISTRY}") string (APPEND _${_PYTHON_PREFIX}_SIGNATURE ":${_${_PYTHON_PREFIX}_FIND_REGISTRY}")
endif() endif()

View File

@@ -140,8 +140,7 @@ Hints
``Python2_FIND_STRATEGY`` ``Python2_FIND_STRATEGY``
This variable defines how lookup will be done. This variable defines how lookup will be done.
The ``Python2_FIND_STRATEGY`` variable can be set to empty or one of the The ``Python2_FIND_STRATEGY`` variable can be set to one of the following:
following:
* ``VERSION``: Try to find the most recent version in all specified * ``VERSION``: Try to find the most recent version in all specified
locations. locations.
@@ -154,8 +153,7 @@ Hints
``Python2_FIND_REGISTRY`` ``Python2_FIND_REGISTRY``
On Windows the ``Python2_FIND_REGISTRY`` variable determine the order On Windows the ``Python2_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables. of preference between registry and environment variables.
the ``Python2_FIND_REGISTRY`` variable can be set to empty or one of the the ``Python2_FIND_REGISTRY`` variable can be set to one of the following:
following:
* ``FIRST``: Try to use registry before environment variables. * ``FIRST``: Try to use registry before environment variables.
This is the default. This is the default.
@@ -165,8 +163,8 @@ Hints
``Python2_FIND_FRAMEWORK`` ``Python2_FIND_FRAMEWORK``
On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components. preference between Apple-style and unix-style package components.
This variable can be set to empty or take same values as This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
:variable:`CMAKE_FIND_FRAMEWORK` variable. variable.
.. note:: .. note::
@@ -180,8 +178,8 @@ Hints
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it is active (i.e. the ``activate`` script has been evaluated). In this case, it
takes precedence over ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` takes precedence over ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
variables. The ``Python2_FIND_VIRTUALENV`` variable can be set to empty or variables. The ``Python2_FIND_VIRTUALENV`` variable can be set to one of the
one of the following: following:
* ``FIRST``: The virtual environment is used before any other standard * ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default. paths to look-up for the interpreter. This is the default.

View File

@@ -188,8 +188,7 @@ Hints
``Python3_FIND_STRATEGY`` ``Python3_FIND_STRATEGY``
This variable defines how lookup will be done. This variable defines how lookup will be done.
The ``Python3_FIND_STRATEGY`` variable can be set to empty or one of the The ``Python3_FIND_STRATEGY`` variable can be set to one of the following:
following:
* ``VERSION``: Try to find the most recent version in all specified * ``VERSION``: Try to find the most recent version in all specified
locations. locations.
@@ -202,8 +201,7 @@ Hints
``Python3_FIND_REGISTRY`` ``Python3_FIND_REGISTRY``
On Windows the ``Python3_FIND_REGISTRY`` variable determine the order On Windows the ``Python3_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables. of preference between registry and environment variables.
The ``Python3_FIND_REGISTRY`` variable can be set to empty or one of the The ``Python3_FIND_REGISTRY`` variable can be set to one of the following:
following:
* ``FIRST``: Try to use registry before environment variables. * ``FIRST``: Try to use registry before environment variables.
This is the default. This is the default.
@@ -213,8 +211,8 @@ Hints
``Python3_FIND_FRAMEWORK`` ``Python3_FIND_FRAMEWORK``
On macOS the ``Python3_FIND_FRAMEWORK`` variable determine the order of On macOS the ``Python3_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components. preference between Apple-style and unix-style package components.
This variable can be set to empty or take same values as This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
:variable:`CMAKE_FIND_FRAMEWORK` variable. variable.
.. note:: .. note::
@@ -228,8 +226,8 @@ Hints
``virtualenv`` or ``conda``. It is meaningful only when a virtual environment ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
is active (i.e. the ``activate`` script has been evaluated). In this case, it is active (i.e. the ``activate`` script has been evaluated). In this case, it
takes precedence over ``Python3_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` takes precedence over ``Python3_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
variables. The ``Python3_FIND_VIRTUALENV`` variable can be set to empty or variables. The ``Python3_FIND_VIRTUALENV`` variable can be set to one of the
one of the following: following:
* ``FIRST``: The virtual environment is used before any other standard * ``FIRST``: The virtual environment is used before any other standard
paths to look-up for the interpreter. This is the default. paths to look-up for the interpreter. This is the default.