summaryrefslogtreecommitdiff
path: root/Modules/FindPython2.cmake
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:14:03 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:14:03 +0900
commitd140263a497b4a86818ab5e2017a66df43eb83fb (patch)
tree4acfe8c906ce669c5fc92689df2c3c83a32d881c /Modules/FindPython2.cmake
parente1763ae434c946bd1c1e9a7cc66a905ebe027bbd (diff)
downloadcmake-d140263a497b4a86818ab5e2017a66df43eb83fb.tar.gz
cmake-d140263a497b4a86818ab5e2017a66df43eb83fb.tar.bz2
cmake-d140263a497b4a86818ab5e2017a66df43eb83fb.zip
Imported Upstream version 3.15.0upstream/3.15.0
Diffstat (limited to 'Modules/FindPython2.cmake')
-rw-r--r--Modules/FindPython2.cmake56
1 files changed, 45 insertions, 11 deletions
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index b9c0b6b73..8372ce74f 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -47,7 +47,11 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`
``Python2::Compiler``
Python 2 compiler. Target defined if component ``Compiler`` is found.
``Python2::Python``
- Python 2 library. Target defined if component ``Development`` is found.
+ Python 2 library for Python embedding. Target defined if component
+ ``Development`` is found.
+``Python2::Module``
+ Python 2 library for Python module. Target defined if component
+ ``Development`` is found.
``Python2::NumPy``
NumPy library for Python 2. Target defined if component ``NumPy`` is found.
@@ -134,6 +138,19 @@ Hints
* If set to TRUE, search **only** for static libraries.
* If set to FALSE, search **only** for shared libraries.
+``Python2_FIND_STRATEGY``
+ This variable defines how lookup will be done.
+ The ``Python2_FIND_STRATEGY`` variable can be set to empty or one of the
+ following:
+
+ * ``VERSION``: Try to find the most recent version in all specified
+ locations.
+ This is the default if policy :policy:`CMP0094` is undefined or set to
+ ``OLD``.
+ * ``LOCATION``: Stops lookup as soon as a version satisfying version
+ constraints is founded.
+ This is the default if policy :policy:`CMP0094` is set to ``NEW``.
+
``Python2_FIND_REGISTRY``
On Windows the ``Python2_FIND_REGISTRY`` variable determine the order
of preference between registry and environment variables.
@@ -145,28 +162,45 @@ Hints
* ``LAST``: Try to use registry after environment variables.
* ``NEVER``: Never try to use registry.
-``CMAKE_FIND_FRAMEWORK``
- On macOS the :variable:`CMAKE_FIND_FRAMEWORK` variable determine the order of
+``Python2_FIND_FRAMEWORK``
+ On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the order of
preference between Apple-style and unix-style package components.
+ This variable can be set to empty or take same values as
+ :variable:`CMAKE_FIND_FRAMEWORK` variable.
.. note::
Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
-.. note::
+ If ``Python2_FIND_FRAMEWORK`` is not defined, :variable:`CMAKE_FIND_FRAMEWORK`
+ variable will be used, if any.
+
+``Python2_FIND_VIRTUALENV``
+ This variable defines the handling of virtual environments. It is meaningfull
+ only when a virtual environment is active (i.e. the ``activate`` script has
+ been evaluated). In this case, it takes precedence over
+ ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK`` variables.
+ The ``Python2_FIND_VIRTUALENV`` variable can be set to empty or one of the
+ following:
- 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.
+ * ``FIRST``: The virtual environment is used before any other standard
+ paths to look-up for the interpreter. This is the default.
+ * ``ONLY``: Only the virtual environment is used to look-up for the
+ interpreter.
+ * ``STANDARD``: The virtual environment is not used to look-up for the
+ interpreter. In this case, variable ``Python2_FIND_REGISTRY`` (Windows)
+ or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or
+ ``NEVER`` to select preferably the interpreter from the virtual
+ environment.
Commands
^^^^^^^^
-This module defines the command ``Python2_add_library`` (when
+This module defines the command ``Python_add_library`` (when
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
-:command:`add_library`, but takes care of Python module naming rules
-(only applied if library is of type ``MODULE``), and adds a dependency to target
-``Python2::Python``::
+:command:`add_library` and adds a dependency to target ``Python2::Python`` or,
+when library type is ``MODULE``, to target ``Python2::Module`` and takes care
+of Python module naming rules::
Python2_add_library (my_module MODULE src1.cpp)