CodeCommitsIssuesPull requestsActionsInsightsSecurity
15dc45b9b25246f03e11138fd711f3f423f55461

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

cmake/analysis.cmake

18lines · modecode

1# This file configures static analysis tools that can be integrated to the build process
2
3option (ENABLE_CLANG_TIDY "Use 'clang-tidy' static analyzer if present" OFF)
4if (ENABLE_CLANG_TIDY)
5 if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
6 message(FATAL_ERROR "clang-tidy requires CMake version at least 3.6.")
7 endif()
8
9 find_program (CLANG_TIDY_PATH NAMES "clang-tidy" "clang-tidy-10" "clang-tidy-9" "clang-tidy-8")
10 if (CLANG_TIDY_PATH)
11 message(STATUS "Using clang-tidy: ${CLANG_TIDY_PATH}. The checks will be run during build process. See the .clang-tidy file at the root directory to configure the checks.")
12 set (USE_CLANG_TIDY 1)
13 # The variable CMAKE_CXX_CLANG_TIDY will be set inside src and base directories with non third-party code.
14 # set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}")
15 else ()
16 message(STATUS "clang-tidy is not found. This is normal - the tool is used only for static code analysis and not essential for build.")
17 endif ()
18endif ()