Clang-tidy integrated into CMakeLists.txt

Can be called from the source directory with:
utils/health/clang-tidy-run.sh
This commit is contained in:
mj-xmr 2020-11-04 19:27:06 +01:00 committed by wowario
parent a76c6b9cae
commit f37d960f75
No known key found for this signature in database
GPG key ID: 24DCBE762DE9C111
3 changed files with 151 additions and 0 deletions

View file

@ -75,6 +75,20 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.0.0")
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${WOWNERO_PARALLEL_LINK_JOBS})
set(CMAKE_JOB_POOL_LINK link_job_pool)
endif ()
endif ()
option (USE_CLANG_TIDY_C "Lint the code with clang-tidy - variant C" OFF)
option (USE_CLANG_TIDY_CXX "Lint the code with clang-tidy - variant C++" OFF)
if (USE_CLANG_TIDY_C AND USE_CLANG_TIDY_CXX)
message(FATAL_ERROR "Enabling both USE_CLANG_TIDY_C and USE_CLANG_TIDY_CXX simultaneously crashes clang-tidy.")
endif()
if (USE_CLANG_TIDY_C OR USE_CLANG_TIDY_CXX)
include(SetClangTidy)
endif()
if (USE_CLANG_TIDY_C)
monero_clang_tidy("C")
elseif (USE_CLANG_TIDY_CXX)
monero_clang_tidy("CXX")
endif()
enable_language(C ASM)