[Bf-blender-cvs] [88926375a0e] master: Clang-Tidy: error out when executable not found

Sybren A. Stüvel noreply at git.blender.org
Fri Nov 6 18:12:17 CET 2020


Commit: 88926375a0e4e45f72c87b9e487c060ddd3c9216
Author: Sybren A. Stüvel
Date:   Fri Nov 6 14:34:04 2020 +0100
Branches: master
https://developer.blender.org/rB88926375a0e4e45f72c87b9e487c060ddd3c9216

Clang-Tidy: error out when executable not found

Stop with an error when the Clang-Tidy executable cannot be found.

Without this check, CMake will happily report "Found Clang-Tidy" but with
the fallback version (0, 0, 0), when `CLANG_TIDY_EXECUTABLE` points to a
non-existing executable.

===================================================================

M	build_files/cmake/Modules/FindClangTidy.cmake

===================================================================

diff --git a/build_files/cmake/Modules/FindClangTidy.cmake b/build_files/cmake/Modules/FindClangTidy.cmake
index d576ad8f100..04c5dfda448 100644
--- a/build_files/cmake/Modules/FindClangTidy.cmake
+++ b/build_files/cmake/Modules/FindClangTidy.cmake
@@ -43,7 +43,10 @@ find_program(CLANG_TIDY_EXECUTABLE
     ${_clang_tidy_SEARCH_DIRS}
 )
 
-if(CLANG_TIDY_EXECUTABLE)
+if(CLANG_TIDY_EXECUTABLE AND NOT EXISTS ${CLANG_TIDY_EXECUTABLE})
+  message(WARNING "Cached or directly specified Clang-Tidy executable does not exist.")
+  set(CLANG_TIDY_FOUND FALSE)
+elseif(CLANG_TIDY_EXECUTABLE)
   # Mark clang-tidy as found.
   set(CLANG_TIDY_FOUND TRUE)



More information about the Bf-blender-cvs mailing list