Skip to content

Commit f86c853

Browse files
committed
Fix escaping in msvc builds
1 parent 28ef44a commit f86c853

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

configure

+15-4
Original file line numberDiff line numberDiff line change
@@ -1180,16 +1180,27 @@ do
11801180
# MSVC requires cmake because that's how we're going to build LLVM
11811181
probe_need CFG_CMAKE cmake
11821182

1183+
# There are three builds of cmake on windows: MSVC, MinGW and Cygwin
1184+
# The Cygwin build does not have generators for Visual Studio, so
1185+
# detect that here and error.
1186+
if ! "$CFG_CMAKE" --help | sed -n '/^Generators/,$p' | grep 'Visual Studio' > /dev/null
1187+
then
1188+
err "cmake does not support Visual Studio generators.\n\n \
1189+
This is likely due to it being an msys/cygwin build of cmake, \
1190+
rather than the required windows version, built using MinGW \
1191+
or Visual Studio."
1192+
fi
1193+
11831194
# Use the REG program to figure out where VS is installed
11841195
# We need to figure out where cl.exe and link.exe are, so we do some
11851196
# munging and some probing here. We also look for the default
11861197
# INCLUDE and LIB variables for MSVC so we can set those in the
11871198
# build system as well.
1188-
install=$(reg QUERY \
1199+
install=$(cmd //c reg QUERY \
11891200
'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0' \
11901201
-v InstallDir)
11911202
if [ -z "$install" ]; then
1192-
install=$(reg QUERY \
1203+
install=$(cmd //c reg QUERY \
11931204
'HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0' \
11941205
-v InstallDir)
11951206
fi
@@ -1222,9 +1233,9 @@ do
12221233
eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""
12231234

12241235
vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
1225-
include_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %INCLUDE%")
1236+
include_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !INCLUDE!)
12261237
need_ok "failed to learn about MSVC's INCLUDE"
1227-
lib_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %LIB%")
1238+
lib_path=$(cmd //V:ON //c "$vcvarsall" $msvc_part \& echo !LIB!)
12281239
need_ok "failed to learn about MSVC's LIB"
12291240

12301241
eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""

0 commit comments

Comments
 (0)