Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 1 | Do not hardcode C std to C99 or C++ std to C++11 if not set |
| 2 | OE compilers are using newer than these standards and absl needs C++14 minimum |
| 3 | |
| 4 | Upstream-Status: Pending |
| 5 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 6 | --- a/CMakeLists.txt |
| 7 | +++ b/CMakeLists.txt |
| 8 | @@ -46,16 +46,6 @@ set_property(CACHE OTBR_MDNS PROPERTY ST |
| 9 | |
| 10 | include("${PROJECT_SOURCE_DIR}/etc/cmake/options.cmake") |
| 11 | |
| 12 | -if(NOT CMAKE_C_STANDARD) |
| 13 | - set(CMAKE_C_STANDARD 99) |
| 14 | - set(CMAKE_C_STANDARD_REQUIRED ON) |
| 15 | -endif() |
| 16 | - |
| 17 | -if(NOT CMAKE_CXX_STANDARD) |
| 18 | - set(CMAKE_CXX_STANDARD 11) |
| 19 | - set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 20 | -endif() |
| 21 | - |
| 22 | set(CMAKE_CXX_EXTENSIONS OFF) |
| 23 | set(CMAKE_EXE_LINKER_FLAGS "-rdynamic ${CMAKE_EXE_LINKER_FLAGS}") |
| 24 | |
| 25 | @@ -63,6 +53,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") |
| 26 | add_compile_options(-Wno-error=nonnull-compare) |
| 27 | endif() |
| 28 | |
| 29 | +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18.1) |
| 30 | + add_compile_options(-Wno-error=vla-cxx-extension) |
| 31 | +endif() |
| 32 | + |
| 33 | if (OTBR_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") |
| 34 | message(STATUS "Coverage: ON") |
| 35 | target_compile_options(otbr-config INTERFACE -g -O0 --coverage) |