diff --git a/CMakeLists.txt b/CMakeLists.txt index 888715414..11fdef620 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ tr_auto_option(ENABLE_MAC "Build Mac client" AUTO) option(ENABLE_NLS "Enable native language support" ON) option(INSTALL_DOC "Build/install documentation" ON) option(INSTALL_LIB "Install the library" OFF) +tr_auto_option(RUN_CLANG_TIDY "Run clang-tidy on the code" AUTO) tr_auto_option(USE_SYSTEM_EVENT2 "Use system event2 library" AUTO) tr_auto_option(USE_SYSTEM_DHT "Use system dht library" AUTO) tr_auto_option(USE_SYSTEM_MINIUPNPC "Use system miniupnpc library" AUTO) @@ -613,7 +614,17 @@ else() endif() endif() -if(NOT CMAKE_VERSION VERSION_LESS "3.7.2") +if(RUN_CLANG_TIDY STREQUAL "AUTO") + if (DEFINED ENV{LGTM_SRC} OR DEFINED ENV{APPVEYOR}) # skip clang-tidy on LGTM/appveyor + set(RUN_CLANG_TIDY OFF) + elseif(CMAKE_VERSION VERSION_LESS "3.7.2") + set(RUN_CLANG_TIDY OFF) + else() + set(RUN_CLANG_TIDY ON) + endif() +endif() + +if(RUN_CLANG_TIDY) message(STATUS "Looking for clang-tidy") find_program(CLANG_TIDY clang-tidy) if (CLANG_TIDY STREQUAL "CLANG_TIDY-NOTFOUND")