Skip to content

Commit

Permalink
Install includes it include/${PROJECT_NAME} (ros2#959)
Browse files Browse the repository at this point in the history
Signed-off-by: Shane Loretz <sloretz@openrobotics.org>
  • Loading branch information
sloretz authored Jan 20, 2022
1 parent 6640eeb commit 0be33d2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 28 deletions.
10 changes: 6 additions & 4 deletions rcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set(${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>")
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
# specific order: dependents before dependencies
ament_target_dependencies(${PROJECT_NAME}
"rcl_interfaces"
Expand Down Expand Up @@ -104,11 +104,13 @@ install(
# This is overwritten each loop, but which one it points to doesn't really matter.
set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")

# specific order: dependents before dependencies
ament_export_include_directories(include)
# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})
# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})

# specific order: dependents before dependencies
ament_export_dependencies(ament_cmake)
ament_export_dependencies(rcl_interfaces)
ament_export_dependencies(rcl_logging_interface)
Expand All @@ -135,5 +137,5 @@ install(
)
install(
DIRECTORY include/
DESTINATION include
DESTINATION include/${PROJECT_NAME}
)
23 changes: 8 additions & 15 deletions rcl_action/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_library(${PROJECT_NAME}

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

ament_target_dependencies(${PROJECT_NAME}
"action_msgs"
Expand All @@ -62,7 +62,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "RCL_ACTION_BUILDING_DLL")

install(
DIRECTORY include/
DESTINATION include
DESTINATION include/${PROJECT_NAME}
)

install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}
Expand All @@ -85,7 +85,6 @@ if(BUILD_TESTING)
)
if(TARGET test_action_client)
target_include_directories(test_action_client PUBLIC
include
src
)
target_link_libraries(test_action_client
Expand Down Expand Up @@ -119,9 +118,6 @@ if(BUILD_TESTING)
PUBLIC "RMW_IMPLEMENTATION=${rmw_implementation}")
target_compile_definitions(${target}${target_suffix}
PUBLIC RCUTILS_ENABLE_FAULT_INJECTION)
target_include_directories(${target}${target_suffix} PUBLIC
include
)
target_link_libraries(${target}${target_suffix}
${PROJECT_NAME}
)
Expand Down Expand Up @@ -151,7 +147,6 @@ if(BUILD_TESTING)
)
if(TARGET test_action_server)
target_include_directories(test_action_server PUBLIC
include
src
)
target_link_libraries(test_action_server
Expand All @@ -168,9 +163,6 @@ if(BUILD_TESTING)
test/rcl_action/test_goal_handle.cpp
)
if(TARGET test_goal_handle)
target_include_directories(test_goal_handle PUBLIC
include
)
target_link_libraries(test_goal_handle
${PROJECT_NAME}
)
Expand All @@ -189,9 +181,6 @@ if(BUILD_TESTING)
test/rcl_action/test_types.cpp
)
if(TARGET test_types)
target_include_directories(test_types PUBLIC
include
)
target_link_libraries(test_types
${PROJECT_NAME}
)
Expand Down Expand Up @@ -224,10 +213,14 @@ if(BUILD_TESTING)
endif()
endif()

# specific order: dependents before dependencies
ament_export_include_directories(include)
# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})

# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})

# specific order: dependents before dependencies
ament_export_dependencies(action_msgs)
ament_export_dependencies(ament_cmake)
ament_export_dependencies(rcl)
Expand Down
12 changes: 8 additions & 4 deletions rcl_lifecycle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_library(

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

# specific order: dependents before dependencies
ament_target_dependencies(rcl_lifecycle
Expand Down Expand Up @@ -125,10 +125,14 @@ if(BUILD_TESTING)
endif()
endif()

# specific order: dependents before dependencies
ament_export_include_directories(include)
# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})

# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})

# specific order: dependents before dependencies
ament_export_dependencies(ament_cmake)
ament_export_dependencies(lifecycle_msgs)
ament_export_dependencies(rcl)
Expand All @@ -139,4 +143,4 @@ ament_package()

install(
DIRECTORY include/
DESTINATION include)
DESTINATION include/${PROJECT_NAME})
14 changes: 9 additions & 5 deletions rcl_yaml_param_parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_library(
${rcl_yaml_parser_sources})
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
ament_target_dependencies(${PROJECT_NAME} "libyaml_vendor" "rcutils" "rmw")

# Set the visibility to hidden by default if possible
Expand Down Expand Up @@ -185,13 +185,17 @@ if(BUILD_TESTING)
endif()
endif()

# Export old-style CMake variables
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})

# Export modern CMake targets
ament_export_targets(${PROJECT_NAME})

ament_export_dependencies(ament_cmake libyaml_vendor)
ament_export_dependencies(rmw)
ament_export_include_directories(include)
install(
DIRECTORY include/
DESTINATION include
DESTINATION include/${PROJECT_NAME}
)
ament_export_libraries(${PROJECT_NAME})
ament_export_targets(${PROJECT_NAME})
ament_package()

0 comments on commit 0be33d2

Please sign in to comment.