Skip to content

Commit

Permalink
Simplify Cmake by linking to the library target (#742)
Browse files Browse the repository at this point in the history
By linking to the library target, we can reuse the include paths and libraries from it. This will
simplify the Cmake a bit.

It also fixes a bug when linking to the `ros2-jazzy` branch of `diagnostic_updater`.
  • Loading branch information
Rayman authored Aug 11, 2024
1 parent 9866fc7 commit c82936f
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions swri_roscpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,11 @@ include(cmake/swri_roscpp-test.cmake)
add_executable(subscriber_test src/nodes/subscriber_test.cpp)
target_include_directories(subscriber_test
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${diagnostic_updater_INCLUDE_DIRS}
${nav_msgs_INCLUDE_DIRS}
${rclcpp_INCLUDE_DIRS}
)
target_link_libraries(subscriber_test
${diagnostic_updater_LIBRARIES}
${marti_common_msgs_LIBRARIES}
${PROJECT_NAME}_library
${nav_msgs_LIBRARIES}
${rclcpp_LIBRARIES}
${std_msgs_LIBRARIES}
${std_srvs_LIBRARIES}
)
### Install Test Node and Headers ###
install(TARGETS subscriber_test
Expand Down

0 comments on commit c82936f

Please sign in to comment.