]> git.ipfire.org Git - thirdparty/ccache.git/blob - cmake/CodeAnalysis.cmake
chore: Remove redundant copy of DEF_WRAP_1_R
[thirdparty/ccache.git] / cmake / CodeAnalysis.cmake
1 option(ENABLE_CPPCHECK "Enable static analysis with Cppcheck" OFF)
2 if(ENABLE_CPPCHECK)
3 find_program(CPPCHECK_EXE cppcheck)
4 mark_as_advanced(CPPCHECK_EXE) # Don't show in CMake UIs
5 if(CPPCHECK_EXE)
6 set(CMAKE_CXX_CPPCHECK
7 ${CPPCHECK_EXE}
8 --suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt
9 --inline-suppr
10 -q
11 --enable=all
12 --force
13 --std=c++17
14 -I ${CMAKE_SOURCE_DIR}
15 --template="cppcheck: warning: {id}:{file}:{line}: {message}"
16 -i src/third_party)
17 else()
18 message(WARNING "Cppcheck requested but executable not found")
19 endif()
20 endif()
21
22 option(ENABLE_CLANG_TIDY "Enable static analysis with Clang-Tidy" OFF)
23 if(ENABLE_CLANG_TIDY)
24 find_program(CLANGTIDY clang-tidy)
25 if(CLANGTIDY)
26 set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY})
27 else()
28 message(SEND_ERROR "Clang-Tidy requested but executable not found")
29 endif()
30 endif()