File: CodeAnalysis.cmake

package info (click to toggle)
ccache 4.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,188 kB
  • sloc: cpp: 47,282; asm: 28,570; sh: 8,674; ansic: 5,357; python: 685; perl: 68; makefile: 23
file content (30 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (3)
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++17
        -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()