Explorar o código

Help: Add missing PRIVATE keyword to target_sources() example

Fixes: #23746
Craig Scott %!s(int64=3) %!d(string=hai) anos
pai
achega
c7c5a50b97
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      Help/command/target_sources.rst

+ 2 - 2
Help/command/target_sources.rst

@@ -52,10 +52,10 @@ expressions to ensure the sources are correctly assigned to the target.
 .. code-block:: cmake
 
   # WRONG: starts with generator expression, but relative path used
-  target_sources(MyTarget "$<$<CONFIG:Debug>:dbgsrc.cpp>")
+  target_sources(MyTarget PRIVATE "$<$<CONFIG:Debug>:dbgsrc.cpp>")
 
   # CORRECT: absolute path used inside the generator expression
-  target_sources(MyTarget "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/dbgsrc.cpp>")
+  target_sources(MyTarget PRIVATE "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/dbgsrc.cpp>")
 
 See the :manual:`cmake-buildsystem(7)` manual for more on defining
 buildsystem properties.