Help: Clarify intended purpose of LINK_WHAT_YOU_USE

Avoid implying that it can be used to intentionally link to
shared libraries whose symbols are not needed.

Issue: #26529
This commit is contained in:
Brad King
2024-12-13 10:50:39 -05:00
parent db5829fc14
commit e4cd54dab2
3 changed files with 20 additions and 12 deletions
@@ -3,7 +3,13 @@ CMAKE_<LANG>_LINK_WHAT_YOU_USE_FLAG
.. versionadded:: 3.22
Linker flag to be used to configure linker so that all specified libraries on
the command line will be linked into the target.
Linker flag used by :prop_tgt:`LINK_WHAT_YOU_USE` to tell the linker to
link all shared libraries specified on the command line even if none
of their symbols is needed. This is an implementation detail used so
that the command in :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK` can check
the binary for unnecessarily-linked shared libraries.
See also variable :variable:`CMAKE_LINK_WHAT_YOU_USE_CHECK`.
.. note::
Do not rely on this abstraction to intentionally link to
shared libraries whose symbols are not needed.
@@ -3,7 +3,8 @@ CMAKE_LINK_WHAT_YOU_USE_CHECK
.. versionadded:: 3.22
Defines the command executed after the link step to check libraries usage.
Command executed by :prop_tgt:`LINK_WHAT_YOU_USE` after the linker to
check for unnecessarily-linked shared libraries.
This check is currently only defined on ``ELF`` platforms with value
``ldd -u -r``.