From ab34b9f9bfee51ada68d026d8abc568faf106d84 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 13 Jan 2023 15:50:29 -0700 Subject: [PATCH] Invoke run-clang-tidy with Python executable This is required since Windows can't support she-bang scripts like macOS and Linux were taking advantange of. This is more verbose but ultimately the same as before. --- cmake/Tidy.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/Tidy.cmake b/cmake/Tidy.cmake index 2b1e6aa07..6f2797511 100644 --- a/cmake/Tidy.cmake +++ b/cmake/Tidy.cmake @@ -19,8 +19,16 @@ else() message(FATAL_ERROR "clang-tidy version ${CMAKE_MATCH_1} is too low") endif() +# Find Python and run-clang-tidy script +find_package(Python 3 REQUIRED) + +find_program(RUN_CLANG_TIDY run-clang-tidy) +if(NOT RUN_CLANG_TIDY) + message(FATAL_ERROR "Failed to find run-clang-tidy script") +endif() + # Run -execute_process(COMMAND run-clang-tidy -clang-tidy-binary ${CLANG_TIDY_EXECUTABLE} -p ${PROJECT_BINARY_DIR} RESULTS_VARIABLE EXIT_CODE) +execute_process(COMMAND ${Python_EXECUTABLE} ${RUN_CLANG_TIDY} -clang-tidy-binary ${CLANG_TIDY_EXECUTABLE} -p ${PROJECT_BINARY_DIR} RESULTS_VARIABLE EXIT_CODE) if(NOT EXIT_CODE STREQUAL 0) message(FATAL_ERROR "Analysis failed") endif()