Skip to content

Commit

Permalink
[#48590] CMakeLists.txt: Add libraries export with 'ament' build-tool
Browse files Browse the repository at this point in the history
Utilizes 'ament_export' directives for exporting libraries along with ROS2 package.

Allows building valid ROS2 package from remote source.
  • Loading branch information
ivysochyn committed Sep 5, 2023
1 parent bdc0c65 commit 834d81d
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ add_library(${PROJECT_NAME} SHARED

target_link_libraries(${PROJECT_NAME}
glfw
Vulkan::Vulkan
${Vulkan_LIBRARIES}
)

ament_target_dependencies(${PROJECT_NAME}
Expand All @@ -76,9 +76,20 @@ target_include_directories(${PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include>
)

install(DIRECTORY
include/
third-party/imgui/
third-party/imgui/backends/
third-party/imgui/misc/cpp/
DESTINATION include
)

ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
ament_export_dependencies(rclcpp)

install(TARGETS
${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
Expand Down Expand Up @@ -113,9 +124,17 @@ ament_target_dependencies(${PROJECT_NAME}_core_widgets
std_srvs
)

ament_export_targets(${PROJECT_NAME}_core_widgetsTargets HAS_LIBRARY_TARGET)
ament_export_dependencies(rcl_interfaces
rclcpp
sensor_msgs
std_msgs
std_srvs
)

install(TARGETS
${PROJECT_NAME}_core_widgets
EXPORT ${PROJECT_NAME}_core_widgets-targets
EXPORT ${PROJECT_NAME}_core_widgetsTargets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
Expand Down

0 comments on commit 834d81d

Please sign in to comment.