Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/Tutorials/Intermediate/Testing/Cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ CMakeLists.txt
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
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``, ``ament_target_dependencies`` and ``target_link_libraries`` as you normally would.
``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
Expand Down
Loading