Skip to content

Commit

Permalink
Use target_link_libraries everywhere (#52)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde authored Jul 1, 2024
1 parent fceb632 commit 052f9a7
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 37 deletions.
29 changes: 17 additions & 12 deletions draco_point_cloud_transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ find_package(std_msgs REQUIRED)
find_package(Draco REQUIRED)

set(dependencies
pluginlib
point_cloud_interfaces
point_cloud_transport
rclcpp
rcpputils
sensor_msgs
std_msgs
pluginlib::pluginlib
${point_cloud_interfaces_TARGETS}
point_cloud_transport::point_cloud_transport
rclcpp::rclcpp
rcpputils::rcpputils
${sensor_msgs_TARGETS}
${std_msgs_TARGETS}
)


include_directories(include ${DRACO_INCLUDE_DIR})
include_directories(include)

add_library(${PROJECT_NAME}
SHARED
Expand All @@ -36,9 +35,15 @@ add_library(${PROJECT_NAME}
src/manifest.cpp
)

target_link_libraries(${PROJECT_NAME} ${DRACO_LIBRARY})

ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_link_libraries(${PROJECT_NAME} PRIVATE
${DRACO_LIBRARY}
${dependencies}
)
target_include_directories(${PROJECT_NAME} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
${DRACO_INCLUDE_DIR}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
Expand Down
18 changes: 11 additions & 7 deletions plugin_template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO (YourNameHere): This is not a working CMake Project!
# TODO (YourNameHere): This is not a working CMake Project!
# Some assembly required for your plugin. (-:

cmake_minimum_required(VERSION 3.10.2)
Expand All @@ -15,13 +15,15 @@ find_package(rclcpp REQUIRED)
# TODO (YourNameHere): You might need more dependencies

set(dependencies
pluginlib
point_cloud_interfaces
point_cloud_transport
rclcpp
pluginlib::pluginlib
${point_cloud_interfaces_TARGETS}
point_cloud_transport::point_cloud_transport
rclcpp::rclcpp
)

include_directories(include)
target_include_directories(${PROJECT_NAME} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

add_library(${PROJECT_NAME}
SHARED
Expand All @@ -31,7 +33,9 @@ add_library(${PROJECT_NAME}
src/template_subscriber.cpp
)

ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_link_libraries(${PROJECT_NAME} PRIVATE
${dependencies}
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
Expand Down
22 changes: 12 additions & 10 deletions zlib_point_cloud_transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ find_package(rclcpp REQUIRED)
find_package(ZLIB REQUIRED)

set(dependencies
pluginlib
point_cloud_interfaces
point_cloud_transport
rclcpp
pluginlib::pluginlib
${point_cloud_interfaces_TARGETS}
point_cloud_transport::point_cloud_transport
rclcpp::rclcpp
)


include_directories(include)

add_library(${PROJECT_NAME}
SHARED
src/zlib_publisher.cpp
Expand All @@ -29,9 +26,14 @@ add_library(${PROJECT_NAME}
src/manifest.cpp
)

target_link_libraries(${PROJECT_NAME} ZLIB::ZLIB)

ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_link_libraries(${PROJECT_NAME} PRIVATE
ZLIB::ZLIB
${dependencies}
)
target_include_directories(${PROJECT_NAME} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
Expand Down
19 changes: 11 additions & 8 deletions zstd_point_cloud_transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@ find_package(point_cloud_transport REQUIRED)
find_package(rclcpp REQUIRED)

set(dependencies
pluginlib
point_cloud_interfaces
point_cloud_transport
rclcpp
pluginlib::pluginlib
${point_cloud_interfaces_TARGETS}
point_cloud_transport::point_cloud_transport
rclcpp::rclcpp
)

include_directories(include)

add_library(${PROJECT_NAME}
SHARED
src/zstd_publisher.cpp
src/zstd_subscriber.cpp
src/manifest.cpp
)

target_link_libraries(${PROJECT_NAME} zstd)
target_link_libraries(${PROJECT_NAME} PRIVATE
zstd
${dependencies}
)

ament_target_dependencies(${PROJECT_NAME} ${dependencies})
target_include_directories(${PROJECT_NAME} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
Expand Down

0 comments on commit 052f9a7

Please sign in to comment.