Skip to content

Commit e84367b

Browse files
authored
Disambiguate Windows run-times when using clang to compile. (#825)
1 parent a8e0915 commit e84367b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,6 +1642,13 @@ impl Build {
16421642
cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into());
16431643
}
16441644

1645+
if cmd.family == ToolFamily::Clang && target.contains("windows") {
1646+
// Disambiguate mingw and msvc on Windows. Problem is that
1647+
// depending on the origin clang can default to a mismatchig
1648+
// run-time.
1649+
cmd.push_cc_arg(format!("--target={}", target).into());
1650+
}
1651+
16451652
if cmd.family == ToolFamily::Clang && target.contains("android") {
16461653
// For compatibility with code that doesn't use pre-defined `__ANDROID__` macro.
16471654
// If compiler used via ndk-build or cmake (officially supported build methods)
@@ -2575,6 +2582,10 @@ impl Build {
25752582
}
25762583
}
25772584

2585+
if target.contains("msvc") && tool.family == ToolFamily::Gnu {
2586+
println!("cargo:warning=GNU compiler is not supported for this target");
2587+
}
2588+
25782589
Ok(tool)
25792590
}
25802591

0 commit comments

Comments
 (0)