[clang] 19401e0 - [clang-format] Fix `check-format-depends` CMake for Windows (#209205)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 02:39:07 PDT 2026
Author: Andrew Ng
Date: 2026-07-14T10:39:03+01:00
New Revision: 19401e09c063367a3503ae6cc1a47babfa95f243
URL: https://github.com/llvm/llvm-project/commit/19401e09c063367a3503ae6cc1a47babfa95f243
DIFF: https://github.com/llvm/llvm-project/commit/19401e09c063367a3503ae6cc1a47babfa95f243.diff
LOG: [clang-format] Fix `check-format-depends` CMake for Windows (#209205)
Add `find_program` for `touch`. Convert found program paths to native
form and use these paths in the command invocation.
Added:
Modified:
clang/lib/Format/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index fcaae71530370..488732430862e 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -43,12 +43,15 @@ file(GLOB_RECURSE files
set(check_format_depends clang-format)
find_program(DIFF_EXE
diff )
-if(DIFF_EXE)
+find_program(TOUCH_EXE touch)
+if(DIFF_EXE AND TOUCH_EXE)
+ file(TO_NATIVE_PATH "${DIFF_EXE}" DIFF_EXE_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${TOUCH_EXE}" TOUCH_EXE_NATIVE_PATH)
set(i 0)
foreach(file IN LISTS files)
add_custom_command(OUTPUT check_format_depend_${i}
- COMMAND clang-format ${file} |
diff -u ${file} - &&
- touch check_format_depend_${i}
+ COMMAND clang-format ${file} | ${DIFF_EXE_NATIVE_PATH} -u ${file} - &&
+ ${TOUCH_EXE_NATIVE_PATH} check_format_depend_${i}
VERBATIM
COMMENT "Checking format of ${file}"
DEPENDS clang-format
More information about the cfe-commits
mailing list