diff --git a/components/script/build.rs b/components/script/build.rs index 189ce765e01..040658b66f2 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -37,7 +37,9 @@ fn main() { // for reasons that I don't understand. If we just give // link.exe, it tries to use script-*/out/link.exe, which of // course does not exist. - build.define("CMAKE_LINKER", "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\link.exe"); + let link = std::process::Command::new("where").arg("link.exe").output().unwrap(); + let link_path: Vec<&str> = std::str::from_utf8(&link.stdout).unwrap().split("\r\n").collect(); + build.define("CMAKE_LINKER", link_path[0]); } build.build(); diff --git a/mach.bat b/mach.bat index e7cba6681bd..5c582605013 100644 --- a/mach.bat +++ b/mach.bat @@ -2,7 +2,7 @@ SET VS_VCVARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat IF EXIST "%VS_VCVARS%" ( - IF NOT DEFINED VisualStudioVersion ( + IF NOT DEFINED Platform ( IF EXIST "%ProgramFiles(x86)%" ( call "%VS_VCVARS%" x64 ) ELSE (