summaryrefslogtreecommitdiff
path: root/Help/prop_tgt
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-03-14 11:54:56 +0000
committerKitware Robot <kwrobot@kitware.com>2022-03-14 07:55:10 -0400
commitf0bb4a461a742d879645bc0559d03d2a925e428c (patch)
tree8e16143af37eda8e7b8ca201a434118f7b88d505 /Help/prop_tgt
parent1422ff20aac370587572a9bbf28c2785adc8e459 (diff)
parent95cdce829f7c0ac3dbacb80c69004aea6a3d4d35 (diff)
downloadcmake-f0bb4a461a742d879645bc0559d03d2a925e428c.tar.gz
Merge topic 'doc-LINK_LIBRARIES_ONLY_TARGETS'
95cdce829f Help: Fix typo and improve readability for LINK_LIBRARIES_ONLY_TARGETS Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7068
Diffstat (limited to 'Help/prop_tgt')
-rw-r--r--Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst7
1 files changed, 3 insertions, 4 deletions
diff --git a/Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst b/Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst
index 78fbb02d81..a9af74d4bd 100644
--- a/Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst
+++ b/Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst
@@ -20,17 +20,16 @@ This property is initialized by the value of the
target is created. The property may be explicitly enabled on an imported
target to check its link interface.
-For example, the following code:
+In the following example, CMake will halt with an error at configure time
+because ``miLib`` is not a target:
.. code-block:: cmake
set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS ON)
- add_executable(myLib STATIC myLib.c)
+ add_library(myLib STATIC myLib.c)
add_executable(myExe myExe.c)
target_link_libraries(myExe PRIVATE miLib) # typo for myLib
-will produce a CMake-time error that ``miLib`` is not a target.
-
In order to link toolchain-provided libraries by name while still
enforcing ``LINK_LIBRARIES_ONLY_TARGETS``, use an
:ref:`imported <Imported Targets>`