@@ -26,8 +26,6 @@ find_package(tf2 REQUIRED)
2626find_package (ublox_msgs REQUIRED)
2727find_package (ublox_serialization REQUIRED)
2828
29- include_directories (include )
30-
3129# build node
3230add_library (ublox_gps
3331 src/adr_udr_product.cpp
@@ -46,56 +44,64 @@ add_library(ublox_gps
4644 src/ublox_firmware7.cpp
4745 src/ublox_firmware8.cpp
4846 src/ublox_firmware9.cpp)
49- ament_target_dependencies(ublox_gps
50- "asio"
51- "diagnostic_msgs"
52- "diagnostic_updater"
53- "geometry_msgs"
54- "rcl_interfaces"
55- "rclcpp"
56- "rclcpp_components"
57- "sensor_msgs"
58- "std_msgs"
59- "tf2"
60- "ublox_msgs"
61- "ublox_serialization"
47+ target_include_directories (ublox_gps PUBLIC
48+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>"
49+ "$<INSTALL_INTERFACE:include/${PROJECT_NAME} >"
50+ ${diagnostic_updater_INCLUDE_DIRS}
51+ )
52+ target_link_libraries (ublox_gps PUBLIC
53+ ${asio_LIBRARIES}
54+ ${diagnostic_updater_LIBRARIES}
55+ ${diagnostic_msgs_TARGETS}
56+ ${geometry_msgs_TARGETS}
57+ ${rcl_interfaces_TARGETS}
58+ rclcpp::rclcpp
59+ rclcpp_components::component
60+ ${sensor_msgs_TARGETS}
61+ ${std_msgs_TARGETS}
62+ tf2::tf2
63+ ${ublox_msgs_TARGETS}
64+ ublox_serialization::ublox_serialization
6265)
6366
64- install (TARGETS ublox_gps
67+ install (TARGETS ublox_gps EXPORT export_ ${PROJECT_NAME}
6568 ARCHIVE DESTINATION lib
6669 LIBRARY DESTINATION lib
6770 RUNTIME DESTINATION bin
6871)
6972
7073add_executable (ublox_gps_node src/node_main.cpp)
71- ament_target_dependencies(ublox_gps_node
72- "rclcpp"
74+ target_link_libraries (ublox_gps_node PRIVATE
75+ rclcpp::rclcpp
76+ ublox_gps
7377)
74- target_link_libraries (ublox_gps_node ublox_gps)
7578
7679# build logger node
77- add_executable (ublox_logger_node src/logger_node_pa.cpp src/raw_data_pa.cpp)
78- set_target_properties (ublox_logger_node PROPERTIES OUTPUT_NAME ublox_logger)
79- ament_target_dependencies(ublox_logger_node
80- "rclcpp"
81- "std_msgs"
80+ add_executable (ublox_logger src/logger_node_pa.cpp src/raw_data_pa.cpp)
81+ target_link_libraries ( ublox_logger PRIVATE
82+ rclcpp::rclcpp
83+ ${std_msgs_TARGETS}
84+ ublox_gps
8285)
8386
8487install (TARGETS
85- ublox_gps_node ublox_logger_node
88+ ublox_gps_node ublox_logger
8689 DESTINATION lib/${PROJECT_NAME}
8790)
8891
8992rclcpp_components_register_nodes(ublox_gps
9093 "ublox_node::UbloxNode" )
9194
9295install (DIRECTORY include /
93- DESTINATION include
96+ DESTINATION include / ${PROJECT_NAME}
9497)
9598
9699install (
97100 DIRECTORY launch config
98101 DESTINATION share/${PROJECT_NAME}
99102)
100103
104+ ament_export_include_directories("include/${PROJECT_NAME} " )
105+ ament_export_targets(export_${PROJECT_NAME} )
106+
101107ament_package()
0 commit comments