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.
This commit is contained in:
Chris Thrasher 2023-01-13 15:50:29 -07:00
parent c5c6276291
commit ab34b9f9bf

View File

@ -19,8 +19,16 @@ else()
message(FATAL_ERROR "clang-tidy version ${CMAKE_MATCH_1} is too low") message(FATAL_ERROR "clang-tidy version ${CMAKE_MATCH_1} is too low")
endif() 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 # 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) if(NOT EXIT_CODE STREQUAL 0)
message(FATAL_ERROR "Analysis failed") message(FATAL_ERROR "Analysis failed")
endif() endif()