[clang] [clang-format] Fix `check-format-depends` CMake for Windows (PR #209205)

Andrew Ng via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 1 08:37:46 PDT 2026


================
@@ -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)
----------------
nga888 wrote:

The "found" `diff` and `touch` are used explicitly in `add_custom_command` below and need to be "native" to work on Windows. It's not common but the `PATH` for the CMake invocation might not be the same when actually building the project.

https://github.com/llvm/llvm-project/pull/209205


More information about the cfe-commits mailing list