Skip to content

Commit 1341f3d

Browse files
authored
Update the system tests to C++17. (#510)
The main reason to do this is so that we can compile the tests with the clang static analyzer. As of clang++-14 (what is in Ubuntu 22.04), the default still seems to be C++14, so we need to specify C++17 so that new things in the rclcpp headers work properly. Further, due to reasons I don't fully understand, I needed to set CMAKE_CXX_STANDARD_REQUIRED in order for clang to really use that version. So set this as well. Signed-off-by: Chris Lalancette <[email protected]>
1 parent 36ab150 commit 1341f3d

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

test_cli/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ if(BUILD_TESTING)
1515
endif()
1616
endif()
1717

18-
# Default to C++14
18+
# Default to C++17
1919
if(NOT CMAKE_CXX_STANDARD)
20-
set(CMAKE_CXX_STANDARD 14)
20+
set(CMAKE_CXX_STANDARD 17)
21+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2122
endif()
2223
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2324
add_compile_options(-Wall -Wextra -Wpedantic)

test_cli_remapping/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ if(BUILD_TESTING)
1515
endif()
1616
endif()
1717

18-
# Default to C++14
18+
# Default to C++17
1919
if(NOT CMAKE_CXX_STANDARD)
20-
set(CMAKE_CXX_STANDARD 14)
20+
set(CMAKE_CXX_STANDARD 17)
21+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2122
endif()
2223
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2324
add_compile_options(-Wall -Wextra -Wpedantic)

test_communication/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(test_communication)
44

5-
# Default to C++14
5+
# Default to C++17
66
if(NOT CMAKE_CXX_STANDARD)
7-
set(CMAKE_CXX_STANDARD 14)
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
89
endif()
910
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1011
add_compile_options(-Wall -Wextra -Wpedantic)

test_quality_of_service/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(test_quality_of_service)
44

5-
# Default to C++14
5+
# Default to C++17
66
if(NOT CMAKE_CXX_STANDARD)
7-
set(CMAKE_CXX_STANDARD 14)
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
89
endif()
910

1011
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")

test_rclcpp/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(test_rclcpp)
44

5-
# Default to C++14
5+
# Default to C++17
66
if(NOT CMAKE_CXX_STANDARD)
7-
set(CMAKE_CXX_STANDARD 14)
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
89
endif()
910
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1011
add_compile_options(-Wall -Wextra -Wpedantic)

0 commit comments

Comments
 (0)