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()