-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathStaticAnalyzers.cmake
32 lines (31 loc) · 1.01 KB
/
StaticAnalyzers.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
31
32
if(${PROJECT_NAME_UPPERCASE}_ENABLE_CLANG_TIDY)
find_program(CLANGTIDY NAMES clang-tidy clang-tidy-15 clang-tidy-14 clang-tidy-13)
if(CLANGTIDY)
set(
CMAKE_CXX_CLANG_TIDY ${CLANGTIDY}
-extra-arg=-Wno-unknown-warning-option
)
message(STATUS "Clang-Tidy finished setting up.")
else()
message(SEND_ERROR "Clang-Tidy requested but executable not found.")
endif()
endif()
if(${PROJECT_NAME_UPPERCASE}_ENABLE_CPPCHECK)
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
set(
CMAKE_CXX_CPPCHECK ${CPPCHECK}
--enable=all
--suppress=missingIncludeSystem # False positives
--suppress=preprocessorErrorDirective
--suppress=unusedFunction # False positives
--suppress=unmatchedSuppression # Support different cppcheck versions
--inline-suppr
--relative-paths=${CMAKE_SOURCE_DIR}
--quiet
)
message(STATUS "Cppcheck finished setting up.")
else()
message(SEND_ERROR "Cppcheck requested but executable not found.")
endif()
endif()