1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 15:54:57 +00:00

build: fail if clang-tidy is not found when -DRUN_CLANG_TIDY=ON (#7210)

This commit is contained in:
Yat Ho 2024-10-31 02:29:38 +08:00 committed by GitHub
parent f0e7c3ed74
commit 1f36458e10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -761,19 +761,20 @@ else()
endif() endif()
endif() endif()
if(RUN_CLANG_TIDY STREQUAL "AUTO") if(RUN_CLANG_TIDY STREQUAL "AUTO" AND (DEFINED ENV{LGTM_SRC} OR DEFINED ENV{APPVEYOR})) # skip clang-tidy on LGTM/appveyor
if(DEFINED ENV{LGTM_SRC} OR DEFINED ENV{APPVEYOR}) # skip clang-tidy on LGTM/appveyor
set(RUN_CLANG_TIDY OFF) set(RUN_CLANG_TIDY OFF)
else()
set(RUN_CLANG_TIDY ON)
endif()
endif() endif()
if(RUN_CLANG_TIDY) if(RUN_CLANG_TIDY)
tr_get_required_flag(RUN_CLANG_TIDY CLANG_TIDY_IS_REQUIRED)
message(STATUS "Looking for clang-tidy") message(STATUS "Looking for clang-tidy")
find_program(CLANG_TIDY clang-tidy) find_program(CLANG_TIDY clang-tidy)
if(CLANG_TIDY STREQUAL "CLANG_TIDY-NOTFOUND") if(CLANG_TIDY STREQUAL "CLANG_TIDY-NOTFOUND")
message(STATUS "Looking for clang-tidy - not found") message(STATUS "Looking for clang-tidy - not found")
if(CLANG_TIDY_IS_REQUIRED)
message(FATAL_ERROR "clang-tidy is required but wasn't found")
endif()
else() else()
message(STATUS "Looking for clang-tidy - found") message(STATUS "Looking for clang-tidy - found")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY}") set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY}")