Skip to content

Commit

Permalink
🚩 (cmake): Upgrade std flag to --std=c++17
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Mar 16, 2021
1 parent 814ea4c commit 863604b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"macFrameworkPath": [],
"compilerPath": "/usr/local/bin/arm-none-eabi-gcc",
"cStandard": "gnu11",
"cppStandard": "gnu++14",
"cppStandard": "gnu++17",
"intelliSenseMode": "gcc-arm",
"compilerArgs": [],
"configurationProvider": "ms-vscode.cmake-tools",
Expand Down
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if(ENABLE_CODE_ANALYSIS)
if(CPPCHECK)
set(CMAKE_CXX_CPPCHECK "${CPPCHECK}"
"--platform=${CMAKE_CURRENT_SOURCE_DIR}/tools/config/cppcheck_leka_platform.xml"
"--std=c++14"
"--std=c++17"
"--cppcheck-build-dir=build/cppcheck"
"--enable=all"
"--inconclusive"
Expand All @@ -35,6 +35,18 @@ if(ENABLE_CODE_ANALYSIS)
endif(CPPCHECK)
endif(ENABLE_CODE_ANALYSIS)

# Set C/C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS TRUE)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS TRUE)

# Add custom flags
add_compile_options(
-fdiagnostics-color
$<$<COMPILE_LANGUAGE:CXX>:-Wno-register>
)

# Before all, set ROOT_DIR, MBED_OS_DIR
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(MBED_OS_DIR ${ROOT_DIR}/extern/mbed-os)
Expand Down
9 changes: 0 additions & 9 deletions mbed-cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ list(APPEND CMAKE_MODULE_PATH ${MBED_CMAKE_ROOT_DIR}/utils)
# Fix error: The C Compiler is not able to compile a simple test program
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")

# Add custom flags
add_compile_options(-fdiagnostics-color)

include(CheckTypeSize)
include(Shorthand)
include(Utils)
Expand Down Expand Up @@ -104,12 +101,6 @@ if(NOT MBED_UNITTESTS)
endforeach()
endif()

# Set language standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS TRUE)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_EXTENSIONS TRUE)

# find python (used for memap and several upload methods)
# -------------------------------------------------------------

Expand Down

0 comments on commit 863604b

Please sign in to comment.