summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2016-06-02 22:08:30 (GMT)
committerBrad King <brad.king@kitware.com>2016-06-17 14:56:40 (GMT)
commit96242f8022fa4bc718ef36cda43f5dfe6236c066 (patch)
treeeb344591def11380b95fba62e71aa950e3671b87 /Help/prop_tgt/LINK_WHAT_YOU_USE.rst
parentba92e11f8b461513566d5cc3c0b53b2215bb85f7 (diff)
downloadCMake-96242f8022fa4bc718ef36cda43f5dfe6236c066.zip
CMake-96242f8022fa4bc718ef36cda43f5dfe6236c066.tar.gz
CMake-96242f8022fa4bc718ef36cda43f5dfe6236c066.tar.bz2
Add options to run `ldd -u -r` as a "link-what-you-use" tool
Create a LINK_WHAT_YOU_USE target property and corresponding CMAKE_LINK_WHAT_YOU_USE variable to enable this behavior. Extend link commands by running `ldd -u -r` to detect shared libraries that are linked but not needed.
Diffstat (limited to 'Help/prop_tgt/LINK_WHAT_YOU_USE.rst')
-rw-r--r--Help/prop_tgt/LINK_WHAT_YOU_USE.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/Help/prop_tgt/LINK_WHAT_YOU_USE.rst b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
new file mode 100644
index 0000000..32d6edb
--- /dev/null
+++ b/Help/prop_tgt/LINK_WHAT_YOU_USE.rst
@@ -0,0 +1,15 @@
+LINK_WHAT_YOU_USE
+---------------------------
+
+This is a boolean option that when set to ``TRUE`` will automatically run
+``ldd -r -u`` on the target after it is linked. In addition, the linker flag
+``-Wl,--no-as-needed`` will be passed to the target with the link command so
+that all libraries specified on the command line will be linked into the
+target. This will result in the link producing a list of libraries that
+provide no symbols used by this target but are being linked to it.
+This is only applicable to executable and shared library targets and
+will only work when ld and ldd accept the flags used.
+
+This property is initialized by the value of
+the :variable:`CMAKE_LINK_WHAT_YOU_USE` variable if it is set
+when a target is created.