cmake/Help/policy/CMP0023.rst

36 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
CMP0023
-------
2019-11-11 23:01:05 +01:00
Plain and keyword :command:`target_link_libraries` signatures cannot be mixed.
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
CMake 2.8.12 introduced the :command:`target_link_libraries` signature using
the ``PUBLIC``, ``PRIVATE``, and ``INTERFACE`` keywords to generalize the
``LINK_PUBLIC`` and ``LINK_PRIVATE`` keywords introduced in CMake 2.8.7.
Use of signatures with any of these keywords sets the link interface of a
2014-08-03 19:52:23 +02:00
target explicitly, even if empty. This produces confusing behavior
when used in combination with the historical behavior of the plain
2019-11-11 23:01:05 +01:00
:command:`target_link_libraries` signature. For example, consider the code:
2014-08-03 19:52:23 +02:00
::
target_link_libraries(mylib A)
target_link_libraries(mylib PRIVATE B)
After the first line the link interface has not been set explicitly so
CMake would use the link implementation, A, as the link interface.
However, the second line sets the link interface to empty. In order
to avoid this subtle behavior CMake now prefers to disallow mixing the
2019-11-11 23:01:05 +01:00
plain and keyword signatures of :command:`target_link_libraries` for a single
2014-08-03 19:52:23 +02:00
target.
2019-11-11 23:01:05 +01:00
The ``OLD`` behavior for this policy is to allow keyword and plain
:command:`target_link_libraries` signatures to be mixed. The ``NEW`` behavior for
2014-08-03 19:52:23 +02:00
this policy is to not to allow mixing of the keyword and plain
signatures.
2024-04-14 22:45:38 +02:00
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.12
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
2015-08-17 11:37:30 +02:00
.. include:: DEPRECATED.txt