Просмотр исходного кода

Help: Fix typo and improve readability for LINK_LIBRARIES_ONLY_TARGETS

Craig Scott 3 лет назад
Родитель
Сommit
95cdce829f
1 измененных файлов с 3 добавлено и 4 удалено
  1. 3 4
      Help/prop_tgt/LINK_LIBRARIES_ONLY_TARGETS.rst

+ 3 - 4
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 is created.  The property may be explicitly enabled on an imported
 target to check its link interface.
 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
 .. code-block:: cmake
 
 
   set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS ON)
   set(CMAKE_LINK_LIBRARIES_ONLY_TARGETS ON)
-  add_executable(myLib STATIC myLib.c)
+  add_library(myLib STATIC myLib.c)
   add_executable(myExe myExe.c)
   add_executable(myExe myExe.c)
   target_link_libraries(myExe PRIVATE miLib) # typo for myLib
   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
 In order to link toolchain-provided libraries by name while still
 enforcing ``LINK_LIBRARIES_ONLY_TARGETS``, use an
 enforcing ``LINK_LIBRARIES_ONLY_TARGETS``, use an
 :ref:`imported <Imported Targets>`
 :ref:`imported <Imported Targets>`