Skip to content

Conversation

@HansRobo
Copy link

@HansRobo HansRobo commented Nov 27, 2025

Description

This pull-request adds rosidl_auto_generate_inetrfaces function to simplify boilerplate CMake in interface packages.

rosidl_auto_generate_inetrfaces function was originally planned as the ament_auto_generate_code function. However, when I implemented it in ament/ament_cmake#600, I was advised to move it to rosidl_cmake because ament_cmake's dependency on rosidl_cmake would create a circular dependency.

Using rosidl_auto_generate_inetrfaces simplifies CMake for interface packages as follows:

before

cmake_minimum_required(VERSION 3.12)
project(my_interfaces)

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/Test.msg"
  "msg/TestA.msg"
  "msg/TestB.msg"
  DEPENDENCIES std_msgs
  ADD_LINTER_TESTS
)

ament_export_dependencies(rosidl_default_runtime)

ament_package()

after

cmake_minimum_required(VERSION 3.12)
project(my_interfaces)

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(std_msgs REQUIRED)

rosidl_auto_generate_interfaces(ADD_LINTER_TESTS)

ament_package()

Is this user-facing behavior change?

Did you use Generative AI?

I used Gemini 3.0 to review my code.

Additional Information

Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Kotaro Yoshimoto <[email protected]>
Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@fujitatomoya
Copy link
Contributor

@HansRobo is this still draft? it seems ready for review?

@HansRobo HansRobo marked this pull request as ready for review December 2, 2025 00:06
@HansRobo
Copy link
Author

HansRobo commented Dec 2, 2025

Yes, it's ready for review! I checked building with GitHub Actions.
https://github.com/HansRobo/ros2_sandbox/actions/runs/19841766914/job/56851537887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants