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

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
This commit is contained in:
Dirk Thomas 2020-04-22 08:36:38 -07:00 committed by GitHub
parent 4f0406f754
commit 0a48e6bd7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,6 @@ find_package(rmw_implementation REQUIRED)
find_package(rosidl_runtime_c REQUIRED) find_package(rosidl_runtime_c REQUIRED)
find_package(tracetools REQUIRED) find_package(tracetools REQUIRED)
include_directories(include)
include(cmake/rcl_set_symbol_visibility_hidden.cmake) include(cmake/rcl_set_symbol_visibility_hidden.cmake)
include(cmake/get_default_rcl_logging_implementation.cmake) include(cmake/get_default_rcl_logging_implementation.cmake)
get_default_rcl_logging_implementation(RCL_LOGGING_IMPL) get_default_rcl_logging_implementation(RCL_LOGGING_IMPL)
@ -64,6 +63,9 @@ set(${PROJECT_NAME}_sources
) )
add_library(${PROJECT_NAME} ${${PROJECT_NAME}_sources}) add_library(${PROJECT_NAME} ${${PROJECT_NAME}_sources})
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(${PROJECT_NAME} ament_target_dependencies(${PROJECT_NAME}
"rcl_interfaces" "rcl_interfaces"
@ -82,7 +84,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCL_BUILDING_DLL")
rcl_set_symbol_visibility_hidden(${PROJECT_NAME} LANGUAGE "C") rcl_set_symbol_visibility_hidden(${PROJECT_NAME} LANGUAGE "C")
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)
@ -96,6 +98,7 @@ set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
# 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(rcl_interfaces) ament_export_dependencies(rcl_interfaces)