Merge topic 'patch-debug-configurations'

99546ef425 Help: Improve DEBUG_CONFIGURATIONS documentation and usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10477
This commit is contained in:
Brad King 2025-03-18 13:40:38 +00:00 committed by Kitware Robot
commit ff197bc744
2 changed files with 33 additions and 8 deletions

View File

@ -127,11 +127,15 @@ Each ``<item>`` may be:
in the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set). in the :prop_gbl:`DEBUG_CONFIGURATIONS` global property if it is set).
The ``optimized`` keyword corresponds to all other configurations. The The ``optimized`` keyword corresponds to all other configurations. The
``general`` keyword corresponds to all configurations, and is purely ``general`` keyword corresponds to all configurations, and is purely
optional. Higher granularity may be achieved for per-configuration optional. These keywords are interpreted immediately by this command and
rules by creating and linking to therefore have no special meaning when produced by a generator expression.
:ref:`IMPORTED library targets <Imported Targets>`.
These keywords are interpreted immediately by this command and therefore Alternatively, generator expressions like :genex:`$<CONFIG>` provide finer
have no special meaning when produced by a generator expression. per-configuration linking of ``<item>``. For a more structured approach,
higher granularity can be achieved by creating and linking to
:ref:`IMPORTED library targets <Imported Targets>` with the
:prop_tgt:`IMPORTED_CONFIGURATIONS` property set, particularly in find
modules.
Items containing ``::``, such as ``Foo::Bar``, are assumed to be Items containing ``::``, such as ``Foo::Bar``, are assumed to be
:ref:`IMPORTED <Imported Targets>` or :ref:`ALIAS <Alias Targets>` library :ref:`IMPORTED <Imported Targets>` or :ref:`ALIAS <Alias Targets>` library

View File

@ -1,13 +1,34 @@
DEBUG_CONFIGURATIONS DEBUG_CONFIGURATIONS
-------------------- --------------------
Specify which configurations are for debugging. This property specifies which :ref:`Build Configurations` are for debugging.
The value must be a semi-colon separated list of configuration names. The value must be a :ref:`semicolon-separated list <CMake Language Lists>` of
build configuration names.
Currently this property is used only by the :command:`target_link_libraries` Currently this property is used only by the :command:`target_link_libraries`
command. Additional uses may be defined in the future. command. Additional uses may be defined in the future.
This property must be set at the top level of the project and before This property must be set at the top level of the project and before
the first :command:`target_link_libraries` command invocation. If any entry in the first :command:`target_link_libraries` command invocation. If any entry in
the list does not match a valid configuration for the project the the list does not match a valid configuration for the project, the
behavior is undefined. behavior is undefined.
By default, this property is **not set**.
Examples
^^^^^^^^
The following example adds a custom configuration to non-optimized debug
configurations while preserving any existing ones. If the project uses the
default ``Debug`` configuration, it should be included as well.
.. code-block:: cmake
set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS Debug CustomBuild)
See Also
^^^^^^^^
* The :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` target property, which maps build
configurations when linking to :ref:`Imported Targets` that have the
:prop_tgt:`IMPORTED_CONFIGURATIONS` property set.