CppCheck analysis
cppcheck
This module defines functions to help use the cppcheck tool.
enable_cppcheck() enables parsing of the project source files.
run_cppcheck() triggers analysis and generates result file.
- enable_cppcheck
Automatically add parsing with cppcheck.
enable_cppcheck()
The source are retrieved from the compile commands database (see CMAKE_EXPORT_COMPILE_COMMANDS)
- run_cppcheck
Automatically call cppcheck to parse the project source files and generate result file. The result file is created in
${data_base_path}/cppcheck-reports, the actual file name iscppcheck-results.xml.If not set, ${data_base_path} will be set as ${CMAKE_BINARY_DIR}
Usage example:
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cppcheck) enable_cppcheck()
- add_library(FooLib FooLib.cc)
add_executable(FooExe FooExe.cc) add_executable(FooTest FooTest.cc)