Created
August 15, 2023 17:12
-
-
Save scivision/c8a77b8e006914c089991838cbc14388 to your computer and use it in GitHub Desktop.
CMake CppCheck example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.19) | |
project(DemoCppCheck LANGUAGES C CXX) | |
option(cppcheck "Run CppCheck static code analysis") | |
if(cppcheck) | |
find_program(cppcheck_exe NAMES cppcheck REQUIRED) | |
set(cppcheck_opts --enable=all --inline-suppr --quiet --suppressions-list=${PROJECT_SOURCE_DIR}/cppcheck.supp) | |
set(CMAKE_C_CPPCHECK ${cppcheck_exe} --std=c11 ${cppcheck_opts}) | |
set(CMAKE_CXX_CPPCHECK ${cppcheck_exe} --std=c++20 ${cppcheck_opts}) | |
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
missingIncludeSystem | |
constParameter | |
unusedFunction | |
unmatchedSuppression |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment