CMakeExpandImportedTargets: Sync documentation

- Added intro code block showing how to include this module.
- Used word "command" instead of "function".
This commit is contained in:
Peter Kokot
2025-05-26 00:51:46 +02:00
parent cfcff29087
commit 0723c36ffc

View File

@@ -16,6 +16,12 @@ CMakeExpandImportedTargets
:command:`try_compile` command and since CMake 3.2 for :command:`try_run` :command:`try_compile` command and since CMake 3.2 for :command:`try_run`
command). command).
Load this module in a CMake project with:
.. code-block:: cmake
include(CMakeExpandImportedTargets)
.. note:: .. note::
This module does not support the policy :policy:`CMP0022` ``NEW`` behavior, This module does not support the policy :policy:`CMP0022` ``NEW`` behavior,
@@ -23,13 +29,17 @@ CMakeExpandImportedTargets
:manual:`generator expressions <cmake-generator-expressions(7)>` cannot be :manual:`generator expressions <cmake-generator-expressions(7)>` cannot be
evaluated at the configuration phase. evaluated at the configuration phase.
Functions Commands
^^^^^^^^^ ^^^^^^^^^
This module defines the following function: This module provides the following command:
.. command:: cmake_expand_imported_targets .. command:: cmake_expand_imported_targets
Expands all imported targets in a given list of libraries to their
corresponding file paths on disk and stores the resulting list in a local
variable:
.. code-block:: cmake .. code-block:: cmake
cmake_expand_imported_targets( cmake_expand_imported_targets(
@@ -38,19 +48,18 @@ This module defines the following function:
[CONFIGURATION <config>] [CONFIGURATION <config>]
) )
Expands all imported targets in a list of libraries ``<libs>...`` to their The arguments are:
corresponding file paths on disk and stores the resulting list in a local
variable ``<result-var>``.
The options are: ``<result-var>``
Name of a CMake variable containing the resulting list of file paths.
``LIBRARIES`` ``LIBRARIES <libs>...``
A :ref:`semicolon-separated list <CMake Language Lists>` of system and A :ref:`semicolon-separated list <CMake Language Lists>` of system and
imported targets. Imported targets in this list are replaced with their imported targets. Imported targets in this list are replaced with their
corresponding library file paths, including libraries from their link corresponding library file paths, including libraries from their link
interfaces. interfaces.
``CONFIGURATION`` ``CONFIGURATION <config>``
If this option is given, it uses the respective build configuration If this option is given, it uses the respective build configuration
``<config>`` of the imported targets if it exists. If omitted, it defaults ``<config>`` of the imported targets if it exists. If omitted, it defaults
to the first entry in the :variable:`CMAKE_CONFIGURATION_TYPES` variable, or to the first entry in the :variable:`CMAKE_CONFIGURATION_TYPES` variable, or