From 3d35561465222e2bd46bb97587f9eb038f9ae35a Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Thu, 22 Oct 2026 15:38:24 +0200 Subject: [PATCH] Add CMake option to fix clang-format binary. --- cmake/CLangFormat.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/CLangFormat.cmake b/cmake/CLangFormat.cmake index 9ddc4edb2..83c0663ac 100644 --- a/cmake/CLangFormat.cmake +++ b/cmake/CLangFormat.cmake @@ -13,6 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set(CLANG_FORMAT_EXECUTABLE "clang-format" CACHE STRING "Name of the clang-format executable to use") + set(EXCLUDED_DIRS # third-party directories src/thirdparty @@ -53,7 +55,7 @@ add_custom_command( TARGET format PRE_BUILD COMMAND find src tests "\\(" -name "\\*.h" -o -name "\\*.cpp" ${FIND_EXCLUDE_DIR_EXPR} "\\)" - ${FIND_EXCLUDE_FILE_EXPR} -type f -print0 | xargs -0 -P0 -n10 clang-format -style=file -i + ${FIND_EXCLUDE_FILE_EXPR} -type f -print0 | xargs -0 -P0 -n10 "${CLANG_FORMAT_EXECUTABLE}" -style=file -i COMMENT "Formatting source files..." WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})