CMP0022.rst 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. CMP0022
  2. -------
  3. .. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
  4. .. include:: include/REMOVED_PROLOGUE.rst
  5. :prop_tgt:`INTERFACE_LINK_LIBRARIES` defines the link interface.
  6. CMake 2.8.11 constructed the 'link interface' of a target from
  7. properties matching ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
  8. The modern way to specify config-sensitive content is to use generator
  9. expressions and the ``IMPORTED_`` prefix makes uniform processing of the
  10. link interface with generator expressions impossible. The
  11. :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property was introduced as a
  12. replacement in CMake 2.8.12. This new property is named consistently
  13. with the ``INTERFACE_COMPILE_DEFINITIONS``, ``INTERFACE_INCLUDE_DIRECTORIES``
  14. and ``INTERFACE_COMPILE_OPTIONS`` properties. For in-build targets, CMake
  15. will use the INTERFACE_LINK_LIBRARIES property as the source of the
  16. link interface only if policy ``CMP0022`` is ``NEW``. When exporting a target
  17. which has this policy set to ``NEW``, only the :prop_tgt:`INTERFACE_LINK_LIBRARIES`
  18. property will be processed and generated for the ``IMPORTED`` target by
  19. default. A new option to the :command:`install(EXPORT)` and export commands
  20. allows export of the old-style properties for compatibility with
  21. downstream users of CMake versions older than 2.8.12. The
  22. :command:`target_link_libraries` command will no longer populate the properties
  23. matching ``LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` if this policy is ``NEW``.
  24. Warning-free future-compatible code which works with CMake 2.8.7 onwards
  25. can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
  26. of :command:`target_link_libraries`.
  27. The ``OLD`` behavior for this policy is to ignore the
  28. :prop_tgt:`INTERFACE_LINK_LIBRARIES` property for in-build targets.
  29. The ``NEW`` behavior for this policy is to use the ``INTERFACE_LINK_LIBRARIES``
  30. property for in-build targets, and ignore the old properties matching
  31. ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?``.
  32. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
  33. .. |WARNED_OR_DID_NOT_WARN| replace:: warned
  34. .. include:: include/REMOVED_EPILOGUE.rst