Update: Using C++26 with contracts enabled
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
function(course_add_cppcheck_targets)
|
||||||
|
find_program(CPPCHECK_EXECUTABLE cppcheck)
|
||||||
|
if(NOT CPPCHECK_EXECUTABLE)
|
||||||
|
message(STATUS "cppcheck not found; cppcheck targets will not be available")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_compile_commands "${CMAKE_BINARY_DIR}/compile_commands.json")
|
||||||
|
set(_suppressions "${CMAKE_SOURCE_DIR}/cppcheck/suppressions.txt")
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
cppcheck_modules
|
||||||
|
COMMAND
|
||||||
|
"${CPPCHECK_EXECUTABLE}"
|
||||||
|
--project=${_compile_commands}
|
||||||
|
--enable=warning,style,performance
|
||||||
|
--std=c++26
|
||||||
|
--inline-suppr
|
||||||
|
--suppressions-list=${_suppressions}
|
||||||
|
-i${CMAKE_SOURCE_DIR}/support
|
||||||
|
-i${CMAKE_BINARY_DIR}/_deps
|
||||||
|
--quiet
|
||||||
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||||
|
COMMENT "Running cppcheck on course modules (build once before running this target)"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
cppcheck_project
|
||||||
|
COMMAND
|
||||||
|
"${CPPCHECK_EXECUTABLE}"
|
||||||
|
--project=${_compile_commands}
|
||||||
|
--enable=warning,style,performance
|
||||||
|
--std=c++26
|
||||||
|
--inline-suppr
|
||||||
|
--suppressions-list=${_suppressions}
|
||||||
|
--quiet
|
||||||
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||||
|
COMMENT "Running cppcheck on entire project (build once before running this target)"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Suppress Cppcheck noise for this GCC 16 / C++26 project.
|
||||||
|
#
|
||||||
|
# The CLion Cppcheck plugin analyzes headers in isolation and often reports
|
||||||
|
# false positives (missing system includes, GCC libstdc++ syntax errors).
|
||||||
|
# Prefer: cmake --build build --target cppcheck_modules
|
||||||
|
|
||||||
|
missingIncludeSystem
|
||||||
|
syntaxError
|
||||||
Reference in New Issue
Block a user