diff options
Diffstat (limited to 'Modules/FindPython.cmake')
-rw-r--r-- | Modules/FindPython.cmake | 112 |
1 files changed, 99 insertions, 13 deletions
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 5fc6a3b..a4b7a03 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -10,25 +10,32 @@ FindPython Find Python interpreter, compiler and development environment (include directories and libraries). -When a version is requested, it can be specified as a simple value or as a -range. For a detailed description of version range usage and capabilities, -refer to the :command:`find_package` command. +.. versionadded:: 3.19 + When a version is requested, it can be specified as a simple value or as a + range. For a detailed description of version range usage and capabilities, + refer to the :command:`find_package` command. The following components are supported: * ``Interpreter``: search for Python interpreter. * ``Compiler``: search for Python compiler. Only offered by IronPython. * ``Development``: search for development artifacts (include directories and - libraries). This component includes two sub-components which can be specified - independently: + libraries). - * ``Development.Module``: search for artifacts for Python module - developments. - * ``Development.Embed``: search for artifacts for Python embedding - developments. + .. versionadded:: 3.18 + This component includes two sub-components which can be specified + independently: + + * ``Development.Module``: search for artifacts for Python module + developments. + * ``Development.Embed``: search for artifacts for Python embedding + developments. * ``NumPy``: search for NumPy include directories. +.. versionadded:: 3.14 + Added the ``NumPy`` component. + If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. If component ``Development`` is specified, it implies sub-components @@ -56,20 +63,30 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and Imported Targets ^^^^^^^^^^^^^^^^ -This module defines the following :ref:`Imported Targets <Imported Targets>` -(when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``): +This module defines the following :ref:`Imported Targets <Imported Targets>`: + +.. versionchanged:: 3.14 + :ref:`Imported Targets <Imported Targets>` are only created when + :prop_gbl:`CMAKE_ROLE` is ``PROJECT``. ``Python::Interpreter`` Python interpreter. Target defined if component ``Interpreter`` is found. ``Python::Compiler`` Python compiler. Target defined if component ``Compiler`` is found. + ``Python::Module`` + .. versionadded:: 3.15 + Python library for Python module. Target defined if component ``Development.Module`` is found. + ``Python::Python`` Python library for Python embedding. Target defined if component ``Development.Embed`` is found. + ``Python::NumPy`` + .. versionadded:: 3.14 + NumPy Python library. Target defined if component ``NumPy`` is found. Result Variables @@ -116,7 +133,10 @@ This module will set the following variables in your project Information returned by ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)`` or else ``sysconfig.get_path('platlib')``. + ``Python_SOABI`` + .. versionadded:: 3.17 + Extension suffix for modules. Information returned by @@ -125,6 +145,7 @@ This module will set the following variables in your project ``python-config --extension-suffix``. If package ``distutils.sysconfig`` is not available, ``sysconfig.get_config_var('SOABI')`` or ``sysconfig.get_config_var('EXT_SUFFIX')`` are used. + ``Python_Compiler_FOUND`` System has the Python compiler. ``Python_COMPILER`` @@ -132,19 +153,35 @@ This module will set the following variables in your project ``Python_COMPILER_ID`` A short string unique to the compiler. Possible values include: * IronPython + ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. + ``Python_Development_FOUND`` System has the Python development artifacts. + ``Python_Development.Module_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python module. + ``Python_Development.Embed_FOUND`` + .. versionadded:: 3.18 + System has the Python development artifacts for Python embedding. + ``Python_INCLUDE_DIRS`` + The Python include directories. + ``Python_LINK_OPTIONS`` + .. versionadded:: 3.19 + The Python link options. Some configurations require specific link options for a correct build and execution. + ``Python_LIBRARIES`` The Python libraries. ``Python_LIBRARY_DIRS`` @@ -159,13 +196,25 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. + ``Python_PyPy_VERSION`` + .. versionadded:: 3.18 + Python PyPy version. + ``Python_NumPy_FOUND`` + .. versionadded:: 3.14 + System has the NumPy. + ``Python_NumPy_INCLUDE_DIRS`` + .. versionadded:: 3.14 + The NumPy include directories. + ``Python_NumPy_VERSION`` + .. versionadded:: 3.14 + The NumPy version. Hints @@ -181,6 +230,8 @@ Hints * If set to FALSE, search **only** for shared libraries. ``Python_FIND_ABI`` + .. versionadded:: 3.16 + This variable defines which ABIs, as defined in `PEP 3149 <https://www.python.org/dev/peps/pep-3149/>`_, should be searched. @@ -226,6 +277,8 @@ Hints each flag is ``OFF`` or ``ANY``. ``Python_FIND_STRATEGY`` + .. versionadded:: 3.15 + This variable defines how lookup will be done. The ``Python_FIND_STRATEGY`` variable can be set to one of the following: @@ -238,6 +291,8 @@ Hints This is the default if policy :policy:`CMP0094` is set to ``NEW``. ``Python_FIND_REGISTRY`` + .. versionadded:: 3.13 + On Windows the ``Python_FIND_REGISTRY`` variable determine the order of preference between registry and environment variables. the ``Python_FIND_REGISTRY`` variable can be set to one of the following: @@ -248,6 +303,8 @@ Hints * ``NEVER``: Never try to use registry. ``Python_FIND_FRAMEWORK`` + .. versionadded:: 3.15 + On macOS the ``Python_FIND_FRAMEWORK`` variable determine the order of preference between Apple-style and unix-style package components. This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK` @@ -261,6 +318,8 @@ Hints variable will be used, if any. ``Python_FIND_VIRTUALENV`` + .. versionadded:: 3.15 + This variable defines the handling of virtual environments managed by ``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 @@ -279,6 +338,9 @@ Hints ``NEVER`` to select preferably the interpreter from the virtual environment. + .. versionadded:: 3.17 + Added support for ``conda`` environments. + .. note:: If the component ``Development`` is requested, it is **strongly** @@ -286,6 +348,8 @@ Hints result. ``Python_FIND_IMPLEMENTATIONS`` + .. versionadded:: 3.18 + This variable defines, in an ordered list, the different implementations which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can hold the following values: @@ -318,9 +382,26 @@ Hints ``.Net`` interpreter (i.e. ``mono`` command) is expected to be available through the ``PATH`` variable. +``Python_FIND_UNVERSIONED_NAMES`` + .. versionadded:: 3.20 + + This variable defines how the generic names will be searched. Currently, it + only applies to the generic names of the interpreter, namely, ``python3`` or + ``python2`` and ``python``. + The ``Python_FIND_UNVERSIONED_NAMES`` variable can be set to one of the + following values: + + * ``FIRST``: The generic names are searched before the more specialized ones + (such as ``python2.5`` for example). + * ``LAST``: The generic names are searched after the more specialized ones. + This is the default. + * ``NEVER``: The generic name are not searched at all. + Artifacts Specification ^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 3.16 + To solve special cases, it is possible to specify directly the artifacts by setting the following variables: @@ -331,6 +412,8 @@ setting the following variables: The path to the compiler. ``Python_DOTNET_LAUNCHER`` + .. versionadded:: 3.18 + The ``.Net`` interpreter. Only used by ``IronPython`` implementation. ``Python_LIBRARY`` @@ -367,6 +450,8 @@ specification. So, to enable also interactive specification, module behavior can be controlled with the following variable: ``Python_ARTIFACTS_INTERACTIVE`` + .. versionadded:: 3.18 + Selects the behavior of the module. This is a boolean variable: * If set to ``TRUE``: Create CMake cache entries for the above artifact @@ -389,8 +474,9 @@ Python module naming rules:: If the library type is not specified, ``MODULE`` is assumed. -For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the -module suffix will include the ``Python_SOABI`` value, if any. +.. versionadded:: 3.17 + For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the + module suffix will include the ``Python_SOABI`` value, if any. #]=======================================================================] |