Skip to content

Commit

Permalink
Standardize cmake (PickNikRobotics#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjw authored Sep 29, 2022
1 parent f8a6287 commit 9c31993
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 33 deletions.
37 changes: 21 additions & 16 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.16)
project(generate_parameter_library_example)

find_package(ament_cmake REQUIRED)
Expand Down Expand Up @@ -29,20 +29,6 @@ rclcpp_components_register_node(minimal_publisher
EXECUTABLE test_node
)

install(DIRECTORY include/ DESTINATION include/)
install(TARGETS minimal_publisher admittance_controller_parameters
EXPORT generate_parameter_library_example_export
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(
TARGETS test_node
DESTINATION lib/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt
Expand All @@ -63,5 +49,24 @@ if(BUILD_TESTING)
target_link_libraries(test_example_gmock admittance_controller_parameters rclcpp::rclcpp)
endif()

ament_export_targets(generate_parameter_library_example_export)
install(
DIRECTORY include/
DESTINATION include
)

install(TARGETS minimal_publisher admittance_controller_parameters
EXPORT export_generate_parameter_library_example
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(
TARGETS test_node
DESTINATION lib/generate_parameter_library_example
)

ament_export_targets(export_generate_parameter_library_example HAS_LIBRARY_TARGET)
ament_export_dependencies(rclcpp rclcpp_components)
ament_package()
2 changes: 1 addition & 1 deletion generate_parameter_library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ find_package(ament_cmake REQUIRED)

install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
DESTINATION share/generate_parameter_library
)

if(BUILD_TESTING)
Expand Down
3 changes: 2 additions & 1 deletion generate_parameter_library/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<buildtool_export_depend>generate_parameter_library_py</buildtool_export_depend>

<depend>fmt</depend>
<depend>generate_parameter_library_py</depend>
<depend>parameter_traits</depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
Expand Down
31 changes: 16 additions & 15 deletions parameter_traits/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ target_link_libraries(parameter_traits
tcb_span::tcb_span
)

install(DIRECTORY include/ DESTINATION include/)

install(
TARGETS parameter_traits
EXPORT parameter_traits
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

ament_export_include_directories(include)
ament_export_targets(parameter_traits)
ament_export_dependencies(fmt rclcpp tcb_span)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following lines skip linters
Expand All @@ -44,4 +29,20 @@ if(BUILD_TESTING)
add_subdirectory(test)
endif()

install(
DIRECTORY include/
DESTINATION include
)

install(
TARGETS parameter_traits
EXPORT export_parameter_traits
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

ament_export_targets(export_parameter_traits HAS_LIBRARY_TARGET)
ament_export_dependencies(fmt rclcpp tcb_span)
ament_package()

0 comments on commit 9c31993

Please sign in to comment.