1MAP_IMPORTED_CONFIG_<CONFIG> 2---------------------------- 3 4Map from project configuration to 5:ref:`imported target <IMPORTED targets>`'s configuration. 6 7Set this to the list of configurations of an imported target that may 8be used for the current project's ``<CONFIG>`` configuration. Targets 9imported from another project may not provide the same set of 10configuration names available in the current project. Setting this 11property tells CMake what imported configurations are suitable for use 12when building the ``<CONFIG>`` configuration. The first configuration in 13the list found to be provided by the imported target (i.e. via 14:prop_tgt:`IMPORTED_LOCATION_<CONFIG>` for the mapped-to ``<CONFIG>``) 15is selected. As a special case, an empty list element refers to the 16configuration-less imported target location 17(i.e. :prop_tgt:`IMPORTED_LOCATION`). 18 19If this property is set and no matching configurations are available, 20then the imported target is considered to be not found. This property 21is ignored for non-imported targets. 22 23This property is initialized by the value of the 24:variable:`CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>` variable if it is set when a 25target is created. 26 27Example 28^^^^^^^ 29 30For example creating imported C++ library ``foo``: 31 32.. code-block:: cmake 33 34 add_library(foo STATIC IMPORTED) 35 36Use ``foo_debug`` path for ``Debug`` build type: 37 38.. code-block:: cmake 39 40 set_property( 41 TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG 42 ) 43 44 set_target_properties(foo PROPERTIES 45 IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" 46 IMPORTED_LOCATION_DEBUG "${foo_debug}" 47 ) 48 49Use ``foo_release`` path for ``Release`` build type: 50 51.. code-block:: cmake 52 53 set_property( 54 TARGET foo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE 55 ) 56 57 set_target_properties(foo PROPERTIES 58 IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 59 IMPORTED_LOCATION_RELEASE "${foo_release}" 60 ) 61 62Use ``Release`` version of library for ``MinSizeRel`` and ``RelWithDebInfo`` 63build types: 64 65.. code-block:: cmake 66 67 set_target_properties(foo PROPERTIES 68 MAP_IMPORTED_CONFIG_MINSIZEREL Release 69 MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release 70 ) 71