FindPython: On Windows, Enhance python debug version support

Add the following variables:
* Python_EXECUTABLE_DEBUG
* Python_INTERPRETER
* Python_DEBUG_POSTFIX

and target Python::InterpreterDebug.

python_add_library() command Manage DEBUG_POSTFIX target property based
on the value of Python_DEBUG_POSTFIX variable.

Fixes: #25874
This commit is contained in:
Marc Chevrier
2024-04-27 17:16:52 +02:00
parent 648a7fb9b9
commit c164404b2e
43 changed files with 279 additions and 62 deletions

View File

@@ -77,9 +77,25 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
``Python::Interpreter``
Python interpreter. Target defined if component ``Interpreter`` is found.
Python interpreter. This target is defined only if the ``Interpreter``
component is found.
``Python::InterpreterDebug``
.. versionadded:: 3.30
Python debug interpreter. This target is defined only if the ``Interpreter``
component is found and the ``Python_EXECUTABLE_DEBUG`` variable is defined.
The target is only defined on the ``Windows`` platform.
``Python::InterpreterMultiConfig``
.. versionadded:: 3.30
Python interpreter. The release or debug version of the interpreter will be
used, based on the context (platform, configuration).
This target is defined only if the ``Interpreter`` component is found
``Python::Compiler``
Python compiler. Target defined if component ``Compiler`` is found.
Python compiler. This target is defined only if the ``Compiler`` component is
found.
``Python::Module``
.. versionadded:: 3.15
@@ -114,6 +130,20 @@ This module will set the following variables in your project
System has the Python interpreter.
``Python_EXECUTABLE``
Path to the Python interpreter.
``Python_EXECUTABLE_DEBUG``
.. versionadded:: 3.30
Path to the debug Python interpreter. It is only defined on the ``Windows``
platform.
``Python_INTERPRETER``
.. versionadded:: 3.30
Path to the Python interpreter, defined as a
:manual:`generator expression <cmake-generator-expressions(7)>` selecting
the ``Python_EXECUTABLE`` or ``Python_EXECUTABLE_DEBUG`` variable based on
the context (platform, configuration).
``Python_INTERPRETER_ID``
A short string unique to the interpreter. Possible values include:
* Python
@@ -194,6 +224,12 @@ This module will set the following variables in your project
The Python include directories.
``Python_DEBUG_POSTFIX``
.. versionadded.. 3.30
Postfix of debug python module. This variable can be used to define the
:prop_tgt:`DEBUG_POSTFIX` target property.
``Python_LINK_OPTIONS``
.. versionadded:: 3.19
@@ -537,6 +573,10 @@ If the library type is not specified, ``MODULE`` is assumed.
When option ``WITH_SOABI`` is also specified, the module suffix will include
the ``Python_SOSABI`` value, if any.
.. versionadded:: 3.30
For ``MODULE`` type, the :prop_tgt:`DEBUG_POSTFIX` target property is
initialized with the value of ``Python_DEBUG_POSTFIX`` variable if defined.
#]=======================================================================]