aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 12:25:59 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 12:25:59 +0000
commit628270661843c4d61a2b5bc656daeb3099850e64 (patch)
tree605345c211563e577d3101ee9a2dcb4f52296942 /cmake
parent4494b54d0e4b0b1564a7c66391216b98c8523b0e (diff)
fix(build): pass cmd.exe a native path in the Windows install
find_program returns C:/Windows/System32/cmd.exe, and cmd scans its whole command line for switches, so it read "/cmd.exe" as /c and ran "md.exe /d ..." instead of install.cmd, failing with "The syntax of the command is incorrect." Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Install.cmake.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmake/Install.cmake.in b/cmake/Install.cmake.in
index 7ee27a5..c4dbba7 100644
--- a/cmake/Install.cmake.in
+++ b/cmake/Install.cmake.in
@@ -12,10 +12,12 @@ endif()
set(cpsc_install_windows "@WIN32@")
if(cpsc_install_windows)
cpsc_find_dependency(PROGRAM cpsc_cmd NAMES cmd.exe REQUIRED)
+ # cmd scans its whole command line for switches, so C:/Windows/System32/cmd.exe would read "/cmd.exe" as /c.
+ file(TO_NATIVE_PATH "${cpsc_cmd}" cpsc_cmd_native)
file(TO_NATIVE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/install.cmd" cpsc_installer)
# An explicit "call" keeps cmd's handling of the quoted script path the same on CMake 3.x and 4.x.
execute_process(
- COMMAND "${cpsc_cmd}" /d /c call "${cpsc_installer}"
+ COMMAND "${cpsc_cmd_native}" /d /c call "${cpsc_installer}"
--source-dir "@CMAKE_CURRENT_BINARY_DIR@"
--prefix "${CMAKE_INSTALL_PREFIX}"
RESULT_VARIABLE cpsc_install_result