CMP0022.rst 2.1 KB

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