Skip to content

Commit

Permalink
Use CMAKE_C_STANDARD with Cppcheck run
Browse files Browse the repository at this point in the history
Signed-off-by: Mikko Johannes Koivunalho <[email protected]>
  • Loading branch information
mikkoi committed Oct 28, 2019
1 parent 4e6a773 commit ea4ef37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# E.g. CMAKE_<LANG>_CPPLINT already since CMake 3.8.
find_package(Cppcheck)
if(Cppcheck_FOUND)
set(cppcheck_c_standard "c${CMAKE_C_STANDARD}")
if("${cppcheck_c_standard}" STREQUAL "c90")
set(cppcheck_c_standard "c89")
endif()
set(CMAKE_C_CPPCHECK
"${Cppcheck_EXECUTABLE};--quiet;--std=c89;--enable=warning,style,performance,portability")
"${Cppcheck_EXECUTABLE};--quiet;--std=${cppcheck_c_standard};--enable=warning,style,performance,portability")
endif(Cppcheck_FOUND)
endif(CMAKE_VERSION VERSION_GREATER_EQUAL "3.10")

Expand Down

0 comments on commit ea4ef37

Please sign in to comment.