export targets in a addition to include directories / libraries (#1096)

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
This commit is contained in:
Dirk Thomas 2020-04-27 10:30:33 -07:00 committed by GitHub
parent e0bf4a9c20
commit 45f3976453
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -16,8 +16,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic) add_compile_options(-Wall -Wextra -Wpedantic)
endif() endif()
include_directories(include)
set(${PROJECT_NAME}_SRCS set(${PROJECT_NAME}_SRCS
src/client.cpp src/client.cpp
src/qos.cpp src/qos.cpp
@ -29,6 +27,11 @@ set(${PROJECT_NAME}_SRCS
add_library(${PROJECT_NAME} add_library(${PROJECT_NAME}
${${PROJECT_NAME}_SRCS}) ${${PROJECT_NAME}_SRCS})
target_include_directories(${PROJECT_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
ament_target_dependencies(${PROJECT_NAME} ament_target_dependencies(${PROJECT_NAME}
"action_msgs" "action_msgs"
"rcl_action" "rcl_action"
@ -47,6 +50,7 @@ install(
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
@ -55,6 +59,7 @@ install(
# specific order: dependents before dependencies # specific order: dependents before dependencies
ament_export_include_directories(include) ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME}) ament_export_libraries(${PROJECT_NAME})
ament_export_targets(${PROJECT_NAME})
ament_export_dependencies(ament_cmake) ament_export_dependencies(ament_cmake)
ament_export_dependencies(action_msgs) ament_export_dependencies(action_msgs)

View file

@ -16,8 +16,6 @@ find_package(rcl_lifecycle REQUIRED)
find_package(rosidl_typesupport_cpp REQUIRED) find_package(rosidl_typesupport_cpp REQUIRED)
find_package(lifecycle_msgs REQUIRED) find_package(lifecycle_msgs REQUIRED)
include_directories(include)
### CPP High level library ### CPP High level library
add_library(rclcpp_lifecycle add_library(rclcpp_lifecycle
src/lifecycle_node.cpp src/lifecycle_node.cpp
@ -25,6 +23,10 @@ add_library(rclcpp_lifecycle
src/state.cpp src/state.cpp
src/transition.cpp src/transition.cpp
) )
target_include_directories(${PROJECT_NAME}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
# specific order: dependents before dependencies # specific order: dependents before dependencies
ament_target_dependencies(rclcpp_lifecycle ament_target_dependencies(rclcpp_lifecycle
"rclcpp" "rclcpp"
@ -38,7 +40,7 @@ ament_target_dependencies(rclcpp_lifecycle
target_compile_definitions(rclcpp_lifecycle PRIVATE "RCLCPP_LIFECYCLE_BUILDING_DLL") target_compile_definitions(rclcpp_lifecycle PRIVATE "RCLCPP_LIFECYCLE_BUILDING_DLL")
install(TARGETS install(TARGETS
rclcpp_lifecycle rclcpp_lifecycle EXPORT rclcpp_lifecycle
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
RUNTIME DESTINATION bin) RUNTIME DESTINATION bin)
@ -102,6 +104,7 @@ endif()
# specific order: dependents before dependencies # specific order: dependents before dependencies
ament_export_include_directories(include) ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME}) ament_export_libraries(${PROJECT_NAME})
ament_export_targets(${PROJECT_NAME})
ament_export_dependencies(rclcpp) ament_export_dependencies(rclcpp)
ament_export_dependencies(rcl_lifecycle) ament_export_dependencies(rcl_lifecycle)
ament_export_dependencies(lifecycle_msgs) ament_export_dependencies(lifecycle_msgs)