Skip to content

Commit d031217

Browse files
use C++ 20 in default. (#3187)
Signed-off-by: Tomoya.Fujita <fujita.tomoya@triorb.co.jp> Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
1 parent 569edb8 commit d031217

6 files changed

Lines changed: 19 additions & 16 deletions

File tree

rclcpp_action/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ cmake_minimum_required(VERSION 3.20)
33
project(rclcpp_action)
44

55
find_package(ament_cmake_ros REQUIRED)
6+
find_package(ament_cmake_ros_core REQUIRED)
67
find_package(action_msgs REQUIRED)
78
find_package(rclcpp REQUIRED)
89
find_package(rcl REQUIRED)
910
find_package(rcl_action REQUIRED)
1011
find_package(rcpputils REQUIRED)
1112
find_package(rosidl_runtime_c REQUIRED)
1213

13-
# Default to C++17
14-
if(NOT CMAKE_CXX_STANDARD)
15-
set(CMAKE_CXX_STANDARD 17)
16-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
17-
endif()
1814
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1915
add_compile_options(
2016
-Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual
@@ -42,6 +38,9 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
4238
rcl_action::rcl_action
4339
rclcpp::rclcpp
4440
rosidl_runtime_c::rosidl_runtime_c
41+
# Note we link public on purpose, as we want to export
42+
# the used C++ version as minimum to all consuming packages
43+
ament_cmake_ros_core::ament_ros_defaults
4544
)
4645
target_link_libraries(${PROJECT_NAME} PRIVATE
4746
rcpputils::rcpputils

rclcpp_action/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
<build_export_depend>rosidl_runtime_c</build_export_depend>
2020

21+
<build_depend>ament_cmake_ros_core</build_depend>
2122
<build_depend>rosidl_runtime_c</build_depend>
2223

2324
<depend>action_msgs</depend>

rclcpp_components/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.20)
22

33
project(rclcpp_components)
44

5-
# Default to C++17
6-
if(NOT CMAKE_CXX_STANDARD)
7-
set(CMAKE_CXX_STANDARD 17)
8-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9-
endif()
105
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
116
add_compile_options(
127
-Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual
@@ -15,6 +10,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1510
endif()
1611

1712
find_package(ament_cmake_ros REQUIRED)
13+
find_package(ament_cmake_ros_core REQUIRED)
1814
find_package(ament_index_cpp REQUIRED)
1915
find_package(class_loader REQUIRED)
2016
find_package(composition_interfaces REQUIRED)
@@ -30,7 +26,10 @@ target_include_directories(component INTERFACE
3026
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
3127
target_link_libraries(component INTERFACE
3228
class_loader::class_loader
33-
rclcpp::rclcpp)
29+
rclcpp::rclcpp
30+
# Note we link public on purpose, as we want to export
31+
# the used C++ version as minimum to all consuming packages
32+
ament_cmake_ros_core::ament_ros_defaults)
3433

3534
add_library(
3635
component_manager
@@ -45,6 +44,9 @@ target_link_libraries(component_manager PUBLIC
4544
composition_interfaces::composition_interfaces
4645
rclcpp::rclcpp
4746
rmw::rmw
47+
# Note we link public on purpose, as we want to export
48+
# the used C++ version as minimum to all consuming packages
49+
ament_cmake_ros_core::ament_ros_defaults
4850
)
4951
target_link_libraries(component_manager PRIVATE
5052
ament_index_cpp::ament_index_cpp

rclcpp_components/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<build_export_depend>rcpputils</build_export_depend>
2323
<build_export_depend>rmw</build_export_depend>
2424

25+
<build_depend>ament_cmake_ros_core</build_depend>
2526
<build_depend>ament_index_cpp</build_depend>
2627
<build_depend>class_loader</build_depend>
2728
<build_depend>composition_interfaces</build_depend>

rclcpp_lifecycle/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ cmake_minimum_required(VERSION 3.20)
22

33
project(rclcpp_lifecycle)
44

5-
# Default to C++17
6-
if(NOT CMAKE_CXX_STANDARD)
7-
set(CMAKE_CXX_STANDARD 17)
8-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9-
endif()
105
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
116
add_compile_options(-Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual)
127
endif()
138

149
find_package(ament_cmake_ros REQUIRED)
10+
find_package(ament_cmake_ros_core REQUIRED)
1511
find_package(lifecycle_msgs REQUIRED)
1612
find_package(rcl REQUIRED)
1713
find_package(rclcpp REQUIRED)
@@ -41,6 +37,9 @@ target_link_libraries(${PROJECT_NAME}
4137
rcl_lifecycle::rcl_lifecycle
4238
rcutils::rcutils
4339
rosidl_typesupport_cpp::rosidl_typesupport_cpp
40+
# Note we link public on purpose, as we want to export
41+
# the used C++ version as minimum to all consuming packages
42+
ament_cmake_ros_core::ament_ros_defaults
4443
)
4544

4645
# Causes the visibility macros to use dllexport rather than dllimport,

rclcpp_lifecycle/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
<buildtool_depend>ament_cmake_ros</buildtool_depend>
1818

19+
<build_depend>ament_cmake_ros_core</build_depend>
1920
<build_depend>lifecycle_msgs</build_depend>
2021
<build_depend>rcl</build_depend>
2122
<build_depend>rclcpp</build_depend>

0 commit comments

Comments
 (0)