diff --git a/src/StaticAnalyzers.cmake b/src/StaticAnalyzers.cmake index a1cb60ab..8e8df101 100644 --- a/src/StaticAnalyzers.cmake +++ b/src/StaticAnalyzers.cmake @@ -19,8 +19,19 @@ macro(enable_cppcheck) endmacro() macro(enable_clang_tidy) + # https://github.com/ejfitzgerald/clang-tidy-cache find_program(CLANGTIDY clang-tidy) + find_program( + CLANGTIDY_CACHE + NAMES "clang-tidy-cache" + "clang-tidy-cache-windows-amd64" + "clang-tidy-cache-linux-amd64" + "clang-tidy-cache-darwin-amd64") if(CLANGTIDY) + if(CLANGTIDY_CACHE) + set($ENV{CLANG_TIDY_CACHE_BINARY} ${CLANGTIDY}) + set(CLANGTIDY ${CLANGTIDY_CACHE}) + endif() set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option) if(${CMAKE_CXX_STANDARD}) set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY} -extra-arg=-std=c++${CMAKE_CXX_STANDARD})