Skip to content

Commit 0fd801c

Browse files
alexreinkingclaude
andcommitted
Normalize Python_SITEARCH before passing to find_package
vcpkg overrides find_package with a macro that stores \${ARGN} in a double-quoted string. Textual macro substitution causes the value to be re-parsed as a string literal, so a Windows path whose components start with a letter (e.g. \build_bot -> \b) triggers CMake's CMP0010 invalid-escape-sequence error. Normalizing with file(TO_CMAKE_PATH) converts backslashes to forward slashes before the path reaches the macro. No upstream vcpkg issue exists for this as of 2026-02-25. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8e897b6 commit 0fd801c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

apps/onnx/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ if (NOT Python_FOUND)
108108
return()
109109
endif ()
110110

111+
# Normalize to forward slashes before passing to find_package. vcpkg overrides
112+
# find_package with a macro that stores ${ARGN} in a double-quoted string; if
113+
# the path contains a backslash followed by a letter (e.g. \build_bot -> \b),
114+
# CMake treats it as an escape sequence and errors (CMP0010). file(TO_CMAKE_PATH)
115+
# converts native separators to forward slashes, sidestepping the issue on all
116+
# CMake versions.
117+
file(TO_CMAKE_PATH "${Python_SITEARCH}" Python_SITEARCH)
111118
find_package(pybind11 HINTS "${Python_SITEARCH}")
112119
if (NOT pybind11_FOUND)
113120
message(WARNING "Could NOT find pybind11")

0 commit comments

Comments
 (0)