FindPython: enforce artifacts consistency when cross-compiling

Fixes: #26696
This commit is contained in:
Marc Chevrier
2025-02-16 18:27:23 +01:00
parent 7065c7a586
commit 5c1521c54d
24 changed files with 325 additions and 19 deletions
+15
View File
@@ -48,6 +48,21 @@ If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.
If component ``Development`` is specified, it implies sub-components
``Development.Module`` and ``Development.Embed``.
.. versionchanged:: 4.1
In a cross-compiling mode (i.e. the :variable:`CMAKE_CROSSCOMPILING` variable
is defined to true), the following constraints, when the policy
:policy:`CMP0190` is set to ``NEW``, now apply to the requested components:
* ``Interpreter`` or ``Compiler`` alone: the host artifacts will be searched.
* ``Interpreter`` or ``Compiler`` with ``Development`` or any sub-component:
The target artifacts will be searched. In this case, the
:variable:`CMAKE_CROSSCOMPILING_EMULATOR` variable must be defined and will
be used to execute the interpreter or the compiler.
When both host and target artifacts are needed, two different calls to the
:command:`find_package` command should be done. The
``Python_ARTIFACTS_PREFIX`` variable can be helpful in this situation.
To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` (or one of its sub-components) and ``NumPy``, specify all
components at the same time: