Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 86ad505

Browse files
Fix MSVC Host Cross Compilation (alexcrichton#218)
* Replace \ with / in prefix on msvc * Run cargo fmt * Add comment for path seperator replacement
1 parent 2b0e2b1 commit 86ad505

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ impl Build {
139139
// Change the install directory to happen inside of the build directory.
140140
if host.contains("pc-windows-gnu") {
141141
configure.arg(&format!("--prefix={}", sanitize_sh(&install_dir)));
142+
} else if host.contains("pc-windows-msvc") {
143+
// On Windows, the prefix argument does not support \ path seperators
144+
// when cross compiling.
145+
// Always use / as a path seperator instead of \, since that works for both
146+
// native and cross builds.
147+
configure.arg(&format!(
148+
"--prefix={}",
149+
install_dir.to_str().unwrap().replace("\\", "/")
150+
));
142151
} else {
143152
configure.arg(&format!("--prefix={}", install_dir.display()));
144153
}

0 commit comments

Comments
 (0)