mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Help: Add example to MAP_IMPORTED_CONFIG_<CONFIG> docs
This commit is contained in:
committed by
Brad King
parent
1e0841c672
commit
957bdb9e6e
@@ -23,3 +23,48 @@ is ignored for non-imported targets.
|
|||||||
This property is initialized by the value of the
|
This property is initialized by the value of the
|
||||||
:variable:`CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` variable if it is set when a
|
:variable:`CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` variable if it is set when a
|
||||||
target is created.
|
target is created.
|
||||||
|
|
||||||
|
Example
|
||||||
|
^^^^^^^
|
||||||
|
|
||||||
|
For example creating imported C++ library ``foo``:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
add_library(foo STATIC IMPORTED)
|
||||||
|
|
||||||
|
Use ``foo_debug`` path for ``Debug`` build type:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
set_property(
|
||||||
|
TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(foo PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${foo_debug}"
|
||||||
|
)
|
||||||
|
|
||||||
|
Use ``foo_release`` path for ``Release`` build type:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
set_property(
|
||||||
|
TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(foo PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${foo_release}"
|
||||||
|
)
|
||||||
|
|
||||||
|
Use ``Release`` version of library for ``MinSizeRel`` and ``RelWithDebInfo``
|
||||||
|
build types:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
set_target_properties(foo PROPERTIES
|
||||||
|
MAP_IMPORTED_CONFIG_MINSIZEREL Release
|
||||||
|
MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user