forked from ccache/ccache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeAnalysis.cmake
30 lines (29 loc) · 936 Bytes
/
CodeAnalysis.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
option(ENABLE_CPPCHECK "Enable static analysis with Cppcheck" OFF)
if(ENABLE_CPPCHECK)
find_program(CPPCHECK_EXE cppcheck)
mark_as_advanced(CPPCHECK_EXE) # Don't show in CMake UIs
if(CPPCHECK_EXE)
set(CMAKE_CXX_CPPCHECK
${CPPCHECK_EXE}
--suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt
--inline-suppr
-q
--enable=all
--force
--std=c++14
-I ${CMAKE_SOURCE_DIR}
--template="cppcheck: warning: {id}:{file}:{line}: {message}"
-i src/third_party)
else()
message(WARNING "Cppcheck requested but executable not found")
endif()
endif()
option(ENABLE_CLANG_TIDY "Enable static analysis with Clang-Tidy" OFF)
if(ENABLE_CLANG_TIDY)
find_program(CLANGTIDY clang-tidy)
if(CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY})
else()
message(SEND_ERROR "Clang-Tidy requested but executable not found")
endif()
endif()