CMP0023.rst 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. CMP0023
  2. -------
  3. Plain and keyword target_link_libraries signatures cannot be mixed.
  4. CMake 2.8.12 introduced the target_link_libraries signature using the
  5. PUBLIC, PRIVATE, and INTERFACE keywords to generalize the LINK_PUBLIC
  6. and LINK_PRIVATE keywords introduced in CMake 2.8.7. Use of
  7. signatures with any of these keywords sets the link interface of a
  8. target explicitly, even if empty. This produces confusing behavior
  9. when used in combination with the historical behavior of the plain
  10. target_link_libraries signature. For example, consider the code:
  11. ::
  12. target_link_libraries(mylib A)
  13. target_link_libraries(mylib PRIVATE B)
  14. After the first line the link interface has not been set explicitly so
  15. CMake would use the link implementation, A, as the link interface.
  16. However, the second line sets the link interface to empty. In order
  17. to avoid this subtle behavior CMake now prefers to disallow mixing the
  18. plain and keyword signatures of target_link_libraries for a single
  19. target.
  20. The OLD behavior for this policy is to allow keyword and plain
  21. target_link_libraries signatures to be mixed. The NEW behavior for
  22. this policy is to not to allow mixing of the keyword and plain
  23. signatures.
  24. This policy was introduced in CMake version 2.8.12. CMake version
  25. |release| warns when the policy is not set and uses OLD behavior. Use
  26. the cmake_policy command to set it to OLD or NEW explicitly.
  27. .. include:: DEPRECATED.txt