Skip to content

use C++ 20 in default.#3187

Open
fujitatomoya wants to merge 2 commits into
rollingfrom
fujitatomoya/update-cmake-cxx-std
Open

use C++ 20 in default.#3187
fujitatomoya wants to merge 2 commits into
rollingfrom
fujitatomoya/update-cmake-cxx-std

Conversation

@fujitatomoya

Copy link
Copy Markdown
Collaborator

Description

https://docs.ros.org/en/rolling/Releases/lyrical/supported-platforms.html#minimum-language-requirements

Fixes # (issue)

Is this user-facing behavior change?

Did you use Generative AI?

Additional Information

Signed-off-by: Tomoya.Fujita <fujita.tomoya@triorb.co.jp>
@mergify

mergify Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@jmachowinski

Copy link
Copy Markdown
Collaborator

We already use c++20 by 'inheritance' from rclcpp. The statements you modified at the old way of doing this.

@fujitatomoya

Copy link
Copy Markdown
Collaborator Author

so are you saying we should remove those lines?

my understanding is that these packages still declared C++17 locally in their CMakeLists, so I updated them to match the project's C++20 requirement. If C++20 is already inherited from the parent rclcpp configuration and these settings are effectively unused.

@jmachowinski

Copy link
Copy Markdown
Collaborator

Yes, we should remove this altogether, and replace it by

target_link_libraries(${PROJECT_NAME} PUBLIC
  # Note we link public on purpose, as we want to export
  # the used C++ version as minimum to all consuming packages
  ament_cmake_ros_core::ament_ros_defaults
)

This is the modern way of setting the minimum C++ version.

I would add this explicit for each pkg, even though it is inherited as relying on the upstream pkg seems like bad practice to me. Its like includes were you also include explicitly.

@jmachowinski

Copy link
Copy Markdown
Collaborator

Note, this is per library, not per pkg.

Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde

ahcorde commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Pulls: #3187
Gist: https://gist.githubusercontent.com/ahcorde/c395f919f9fca1e4e45722cd64bbd39c/raw/9effe18c6d1350c8fb18e61d591457891d42ada3/ros2.repos
BUILD args: --packages-above-and-dependencies rclcpp rclcpp_action rclcpp_components rclcpp_lifecycle
TEST args: --packages-above rclcpp rclcpp_action rclcpp_components rclcpp_lifecycle
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19758

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

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