1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 # file Copyright.txt or https://cmake.org/licensing for details. 4 #[=======================================================================[.rst: 8 Find Python 2 interpreter, compiler and development environment (include
9 directories and libraries).
11 The following components are supported:
13 * ``Interpreter``: search
for Python 2 interpreter
14 * ``Compiler``: search
for Python 2 compiler. Only offered by IronPython.
15 * ``Development``: search
for development artifacts (include directories and
16 libraries). This
component includes two sub-components which can be specified
19 * ``Development.Module``: search
for artifacts
for Python 2 module
21 * ``Development.Embed``: search
for artifacts
for Python 2 embedding
24 * ``NumPy``: search
for NumPy include directories.
26 If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.
28 If
component ``Development`` is specified, it implies sub-components
29 ``Development.Module`` and ``Development.Embed``.
31 To ensure consistent versions between components ``Interpreter``, ``Compiler``,
32 ``Development`` (or one of its sub-components) and ``NumPy``, specify all
33 components at the same time::
35 find_package (Python2 COMPONENTS Interpreter Development)
37 This module looks only
for version 2 of Python. This module can be used
38 concurrently with :module:`FindPython3` module to use both Python versions.
40 The :module:`FindPython` module can be used
if Python
version does not matter
45 If components ``Interpreter`` and ``Development`` (or one of its
46 sub-components) are both specified,
this module search only
for interpreter
47 with same platform architecture as the one defined by ``CMake``
48 configuration. This contraint does not apply
if only ``Interpreter``
49 component is specified.
54 This module defines the following :ref:`Imported Targets <Imported Targets>`
55 (when :prop_gbl:`CMAKE_ROLE` is ``PROJECT``):
57 ``Python2::Interpreter``
58 Python 2 interpreter. Target defined
if component ``Interpreter`` is found.
60 Python 2 compiler. Target defined
if component ``Compiler`` is found.
62 Python 2 library
for Python module. Target defined
if component 63 ``Development.Module`` is found.
65 Python 2 library
for Python embedding. Target defined
if component 66 ``Development.Embed`` is found.
68 NumPy library
for Python 2. Target defined
if component ``NumPy`` is found.
73 This module will
set the following variables in your project
74 (see :ref:`Standard Variable Names <CMake Developer Standard Variable Names>`):
77 System has the Python 2 requested components.
78 ``Python2_Interpreter_FOUND``
79 System has the Python 2 interpreter.
80 ``Python2_EXECUTABLE``
81 Path to the Python 2 interpreter.
82 ``Python2_INTERPRETER_ID``
83 A short
string unique to the interpreter. Possible values include:
90 Standard platform independent installation directory.
92 Information returned by
93 ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``
94 or else ``sysconfig.get_path(
'stdlib')``.
96 Standard platform dependent installation directory.
98 Information returned by
99 ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``
100 or else ``sysconfig.get_path(
'platstdlib')``.
102 Third-party platform independent installation directory.
104 Information returned by
105 ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``
106 or else ``sysconfig.get_path(
'purelib')``.
108 Third-party platform dependent installation directory.
110 Information returned by
111 ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
112 or else ``sysconfig.get_path(
'platlib')``.
113 ``Python2_Compiler_FOUND``
114 System has the Python 2 compiler.
116 Path to the Python 2 compiler. Only offered by IronPython.
117 ``Python2_COMPILER_ID``
118 A short
string unique to the compiler. Possible values include:
120 ``Python2_Development_FOUND``
121 System has the Python 2 development artifacts.
122 ``Python2_Development.Module_FOUND``
123 System has the Python 2 development artifacts for Python module.
124 ``Python2_Development.Embed_FOUND``
125 System has the Python 2 development artifacts for Python embedding.
126 ``Python2_INCLUDE_DIRS``
127 The Python 2 include directories.
128 ``Python2_LIBRARIES``
129 The Python 2 libraries.
130 ``Python2_LIBRARY_DIRS``
131 The Python 2 library directories.
132 ``Python2_RUNTIME_LIBRARY_DIRS``
133 The Python 2 runtime library directories.
136 ``Python2_VERSION_MAJOR``
138 ``Python2_VERSION_MINOR``
140 ``Python2_VERSION_PATCH``
142 ``Python2_NumPy_FOUND``
143 System has the NumPy.
144 ``Python2_NumPy_INCLUDE_DIRS``
145 The NumPy include directries.
146 ``Python2_NumPy_VERSION``
153 Define the root directory of a Python 2 installation.
155 ``Python2_USE_STATIC_LIBS``
156 * If not defined, search for shared libraries and static libraries in that
158 * If set to TRUE, search **only** for static libraries.
159 * If set to FALSE, search **only** for shared libraries.
161 ``Python2_FIND_STRATEGY``
162 This variable defines how lookup will be done.
163 The ``Python2_FIND_STRATEGY`` variable can be set to one of the following:
165 * ``
VERSION``: Try to find the most recent
version in all specified
167 This is the default if policy :policy:`CMP0094` is undefined or set to
169 * ``LOCATION``: Stops lookup as soon as a
version satisfying
version 170 constraints is founded.
171 This is the default if policy :policy:`CMP0094` is set to ``NEW``.
173 ``Python2_FIND_REGISTRY``
174 On Windows the ``Python2_FIND_REGISTRY`` variable determine the
order 175 of preference between registry and environment variables.
176 the ``Python2_FIND_REGISTRY`` variable can be set to one of the following:
178 * ``FIRST``: Try to use registry before environment variables.
180 * ``LAST``: Try to use registry after environment variables.
181 * ``NEVER``: Never try to use registry.
183 ``Python2_FIND_FRAMEWORK``
184 On macOS the ``Python2_FIND_FRAMEWORK`` variable determine the
order of
185 preference between Apple-
style and unix-
style package components.
186 This variable can take same values as :variable:`CMAKE_FIND_FRAMEWORK`
191 Value ``ONLY`` is not supported so ``FIRST`` will be used instead.
193 If ``Python2_FIND_FRAMEWORK`` is not defined, :variable:`CMAKE_FIND_FRAMEWORK`
194 variable will be used, if any.
196 ``Python2_FIND_VIRTUALENV``
197 This variable defines the handling of virtual environments managed by
198 ``virtualenv`` or ``conda``. It is meaningful only when a virtual environment
199 is active (i.e. the ``activate`` script has been evaluated). In this case, it
200 takes precedence over ``Python2_FIND_REGISTRY`` and ``CMAKE_FIND_FRAMEWORK``
201 variables. The ``Python2_FIND_VIRTUALENV`` variable can be set to one of the
204 * ``FIRST``: The virtual environment is used before any other standard
205 paths to look-up for the interpreter. This is the default.
206 * ``ONLY``: Only the virtual environment is used to look-up for the
208 * ``STANDARD``: The virtual environment is not used to look-up for the
209 interpreter but environment variable ``PATH`` is always considered.
210 In this case, variable ``Python2_FIND_REGISTRY`` (Windows) or
211 ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with
value ``LAST`` or
212 ``NEVER`` to select preferably the interpreter from the virtual
217 If the
component ``Development`` is requested, it is **strongly**
218 recommended to also include the
component ``Interpreter`` to
get expected
221 Artifacts Specification
222 ^^^^^^^^^^^^^^^^^^^^^^^
224 To solve special cases, it is possible to specify directly the artifacts by
225 setting the following variables:
227 ``Python2_EXECUTABLE``
228 The path to the interpreter.
231 The path to the compiler.
234 The path to the library. It will be used to compute the
235 variables ``Python2_LIBRARIES``, ``Python2_LIBRAY_DIRS`` and
236 ``Python2_RUNTIME_LIBRARY_DIRS``.
238 ``Python2_INCLUDE_DIR``
239 The path to the directory of the ``Python`` headers. It will be used to
240 compute the variable ``Python2_INCLUDE_DIRS``.
242 ``Python2_NumPy_INCLUDE_DIR``
243 The path to the directory of the ``NumPy`` headers. It will be used to
244 compute the variable ``Python2_NumPy_INCLUDE_DIRS``.
248 All paths must be absolute. Any artifact specified with a relative path
253 When an artifact is specified, all ``HINTS`` will be ignored and no search
254 will be performed for this artifact.
256 If more than one artifact is specified, it is the user
's responsability to 257 ensure the consistency of the various artifacts. 259 By default, this module supports multiple calls in different directories of a 260 project with different version/component requirements while providing correct 261 and consistent results for each call. To support this behavior, ``CMake`` cache 262 is not used in the traditional way which can be problematic for interactive 263 specification. So, to enable also interactive specification, module behavior 264 can be controled with the following variable: 266 ``Python2_ARTIFACTS_INTERACTIVE`` 267 Selects the behavior of the module. This is a boolean variable: 269 * If set to ``TRUE``: Create CMake cache entries for the above artifact 270 specification variables so that users can edit them interactively. 271 This disables support for multiple version/component requirements. 272 * If set to ``FALSE`` or undefined: Enable multiple version/component 278 This module defines the command ``Python2_add_library`` (when 279 :prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as 280 :command:`add_library` and adds a dependency to target ``Python2::Python`` or, 281 when library type is ``MODULE``, to target ``Python2::Module`` and takes care 282 of Python module naming rules:: 284 Python2_add_library (<name> [STATIC | SHARED | MODULE] 285 <source1> [<source2> ...]) 287 If library type is not specified, ``MODULE`` is assumed. 288 #]=======================================================================] 291 set (_PYTHON_PREFIX Python2) 293 set (_Python2_REQUIRED_VERSION_MAJOR 2) 295 include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) 297 if (COMMAND __Python2_add_library) 298 macro (Python2_add_library) 299 __Python2_add_library (Python2 ${ARGV}) 303 unset (_PYTHON_PREFIX)
double get(vtkDataArray *const &arr, vtkIdType key)