From b11eaf16310d3ceab04db3d07dd3f90b05a661a5 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Thu, 1 Aug 2024 08:15:04 -0500 Subject: [PATCH] Run format target from project root The CMake format target does not use the correct .clang-format file in out-of-source builds. This instructs CMake to use the project root as the working directory for running the clang-format command so that it finds the .clang-format file. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72fa5427b..7e8a528d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,7 @@ if (YAML_CPP_FORMAT_SOURCE AND YAML_CPP_CLANG_FORMAT_EXE) COMMAND clang-format --style=file -i $ COMMAND_EXPAND_LISTS COMMENT "Running clang-format" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" VERBATIM) endif()