cmake/Help/policy/CMP0022.rst

40 lines
2.1 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
CMP0022
-------
2019-11-11 23:01:05 +01:00
:prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.
2014-08-03 19:52:23 +02:00
CMake 2.8.11 constructed the 'link interface' of a target from
properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
The modern way to specify config-sensitive content is to use generator
expressions and the ``IMPORTED_`` prefix makes uniform processing of the
link interface with generator expressions impossible. The
2019-11-11 23:01:05 +01:00
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property was introduced as a
2014-08-03 19:52:23 +02:00
replacement in CMake 2.8.12. This new property is named consistently
2019-11-11 23:01:05 +01:00
with the ``INTERFACE_COMPILE_DEFINITIONS``, ``INTERFACE_INCLUDE_DIRECTORIES``
and ``INTERFACE_COMPILE_OPTIONS`` properties. For in-build targets, CMake
2014-08-03 19:52:23 +02:00
will use the INTERFACE_LINK_LIBRARIES property as the source of the
2019-11-11 23:01:05 +01:00
link interface only if policy ``CMP0022`` is ``NEW``. When exporting a target
which has this policy set to ``NEW``, only the :prop_tgt:`INTERFACE_LINK_LIBRARIES`
property will be processed and generated for the ``IMPORTED`` target by
default. A new option to the :command:`install(EXPORT)` and export commands
2014-08-03 19:52:23 +02:00
allows export of the old-style properties for compatibility with
downstream users of CMake versions older than 2.8.12. The
2019-11-11 23:01:05 +01:00
:command:`target_link_libraries` command will no longer populate the properties
matching ``LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` if this policy is ``NEW``.
2014-08-03 19:52:23 +02:00
2014-09-13 15:30:52 +02:00
Warning-free future-compatible code which works with CMake 2.8.7 onwards
2014-08-03 19:52:23 +02:00
can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
of :command:`target_link_libraries`.
2019-11-11 23:01:05 +01:00
The ``OLD`` behavior for this policy is to ignore the
:prop_tgt:`INTERFACE_LINK_LIBRARIES` property for in-build targets.
The ``NEW`` behavior for this policy is to use the ``INTERFACE_LINK_LIBRARIES``
2014-08-03 19:52:23 +02:00
property for in-build targets, and ignore the old properties matching
``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
This policy was introduced in CMake version 2.8.12. CMake version
2019-11-11 23:01:05 +01:00
|release| warns when the policy is not set and uses ``OLD`` behavior. Use
the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
2015-08-17 11:37:30 +02:00
.. include:: DEPRECATED.txt