sphere-source-x/cmake/CppCheck.cmake
cbnolok 86373c9233 Add unit testing via DocTest
Moved CppCheck cmake code in a separate file.
2025-05-25 23:38:49 +02:00

28 lines
907 B
CMake

find_program(CMAKE_CXX_CPPCHECK NAMES cppcheck)
if(CMAKE_CXX_CPPCHECK)
include(CheckTypeSize)
check_type_size("void*" SIZEOF_VOID_P)
#message(STATUS "Pointer size = ${SIZEOF_VOID_P}")
list(
APPEND CMAKE_CXX_CPPCHECK
"--verbose"
#"--debug"
"--report-progress"
"--enable=all"
"--safety"
"--inconclusive"
#"--force"
#"--inline-suppr"
"--check-level=exhaustive"
"--template='{file}({line}): {severity} ({id}): {message}'"
#"--checkers-report=${CMAKE_SOURCE_DIR}/cppcheck_out.txt"
"--output-file=${CMAKE_BINARY_DIR}/cppcheck.log"
"--suppressions-list=${CMAKE_SOURCE_DIR}/static_analysis/cppcheck-suppressions.txt"
"--config-exclude=lib/"
"-i lib/"
"-D__SIZEOF_POINTER__=${SIZEOF_VOID_P}"
"-U_TESTEXCEPTION"
"-U_EXCEPTIONS_DEBUG"
)
endif()