Skip to content

Commit e01d94a

Browse files
Add compiler standards (#7)
1 parent ca97fc6 commit e01d94a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ros2_control_cmake/cmake/ros2_control.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ macro(set_compiler_options)
3939
-Werror=missing-braces)
4040
message(STATUS "Compiler warnings enabled for ${CMAKE_CXX_COMPILER_ID}")
4141

42+
# https://docs.ros.org/en/rolling/How-To-Guides/Ament-CMake-Documentation.html#compiler-and-linker-options
43+
if(NOT CMAKE_C_STANDARD)
44+
set(CMAKE_C_STANDARD 99)
45+
endif()
46+
if(NOT CMAKE_CXX_STANDARD)
47+
set(CMAKE_CXX_STANDARD 17)
48+
endif()
49+
4250
# Extract major version if g++ is used
4351
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
4452
extract_gcc_version()

0 commit comments

Comments
 (0)