From 90605d4bd32995c97755716e69032d8aa65c45b1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 12 Sep 2021 14:36:51 -0500 Subject: [PATCH] build: skip clang-tidy on lgtm (#1792) * build: skip clang-tidy on lgtm * build: skip clang-tidy on appveyor Co-authored-by: Mike Gelfand --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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")