Squashed 'cmake/' content from commit 07b56b6

git-subtree-dir: cmake
git-subtree-split: 07b56b6a3dbe9f0c15160b3d11f11702db5e3999
This commit is contained in:
Christina Sander
2022-10-20 13:45:27 +02:00
commit e42ca53cee
23 changed files with 1826 additions and 0 deletions

28
Modules/CppCheck.cmake Normal file
View File

@@ -0,0 +1,28 @@
option(CPPCHECK "Turns cppcheck processing on if executable is found." OFF)
find_program(CPPCHECK_PATH NAMES cppcheck)
# export compile commands to json file to be used by cppcheck
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CPPCHECK_COMPILE_COMMANDS "${CMAKE_BINARY_DIR}/compile_commands.json")
# output directory for codecheck analysis
set(CPPCHECK_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/cppcheck_results)
if(CPPCHECK AND CPPCHECK_PATH AND NOT CPPCHECK_ADDED)
set(CPPCHECK_ADDED ON)
if (NOT TARGET cppcheck)
add_custom_target(cppcheck
COMMAND rm -rf ${CPPCHECK_OUTPUT_DIRECTORY}\;
mkdir -p ${CPPCHECK_OUTPUT_DIRECTORY}\;
${CPPCHECK_PATH}
--project=${CPPCHECK_COMPILE_COMMANDS}
--plist-output=${CPPCHECK_OUTPUT_DIRECTORY}
--enable=all
--inline-suppr
)
endif()
endif()