1#   BAREOS® - Backup Archiving REcovery Open Sourced
2#
3#   Copyright (C) 2019-2019 Bareos GmbH & Co. KG
4#
5#   This program is Free Software; you can redistribute it and/or
6#   modify it under the terms of version three of the GNU Affero General Public
7#   License as published by the Free Software Foundation and included
8#   in the file LICENSE.
9#
10#   This program is distributed in the hope that it will be useful, but
11#   WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13#   Affero General Public License for more details.
14#
15#   You should have received a copy of the GNU Affero General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18#   02110-1301, USA.
19
20if(DO_STATIC_CODE_CHECKS)
21  # analyse the code with clang-tidy, cppcheck, cpplint and iwyu
22  find_program(IWYU iwyu)
23  set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU})
24  set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU})
25
26  set(CMAKE_LINK_WHAT_YOU_USE true)
27
28  find_program(CLANGTIDY clang-tidy)
29  set(CMAKE_CXX_CLANG_TIDY "${CLANGTIDY};-checks=*")
30
31  find_program(CPPCHECK cppcheck)
32  set(CMAKE_CXX_CPPCHECK "${CPPCHECK};--std=c++11")
33
34  find_program(CPPLINT cpplint.py)
35  set(CMAKE_CXX_CPPLINT "${CPPLINT};--linelength=80")
36
37endif()
38