From 4c2169bf02c171607b20b021c01b17d81cf0110d Mon Sep 17 00:00:00 2001 From: Deep Kotadiya <110234271+deep-zspace@users.noreply.github.com> Date: Fri, 15 May 2026 07:10:45 -0400 Subject: [PATCH] Fix C++ testing tutorial: comment out placeholder target_link_libraries > Cpp Testing #2833 (#6766) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix C++ testing tutorial: comment out placeholder target_link_libraries > Cpp Testing #2833 * Update source/Tutorials/Intermediate/Testing/Cpp.rst Co-authored-by: Tomoya Fujita Signed-off-by: Alejandro Hernández Cordero --------- Signed-off-by: Alejandro Hernández Cordero Co-authored-by: Alejandro Hernández Cordero Co-authored-by: Tomoya Fujita (cherry picked from commit a1c1d3e84d768371866bf86253dea63cce57e419) --- source/Tutorials/Intermediate/Testing/Cpp.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Tutorials/Intermediate/Testing/Cpp.rst b/source/Tutorials/Intermediate/Testing/Cpp.rst index 51ddcfbe51b..10917240b19 100644 --- a/source/Tutorials/Intermediate/Testing/Cpp.rst +++ b/source/Tutorials/Intermediate/Testing/Cpp.rst @@ -50,11 +50,12 @@ CMakeLists.txt $ $ ) - target_link_libraries(${PROJECT_NAME}_tutorial_test name_of_local_library) + # target_link_libraries(${PROJECT_NAME}_tutorial_test name_of_local_library) endif() The testing code is wrapped in the ``if/endif`` block to avoid building tests where possible. ``ament_add_gtest`` functions much like ``add_executable`` so you'll need to call ``target_include_directories`` and ``target_link_libraries`` as you normally would. +The ``target_link_libraries`` call is shown commented out because ``name_of_local_library`` is a placeholder, uncomment it and replace ``name_of_local_library`` with the actual target name from your ``add_library()`` call only if your tests depend on a library built in this package. Running Tests