Skip to content

Commit

Permalink
Disambiguate Windows run-times when using clang to compile. (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
dot-asm committed Jul 21, 2023
1 parent a8e0915 commit e84367b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,13 @@ impl Build {
cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into());
}

if cmd.family == ToolFamily::Clang && target.contains("windows") {
// Disambiguate mingw and msvc on Windows. Problem is that
// depending on the origin clang can default to a mismatchig
// run-time.
cmd.push_cc_arg(format!("--target={}", target).into());
}

if cmd.family == ToolFamily::Clang && target.contains("android") {
// For compatibility with code that doesn't use pre-defined `__ANDROID__` macro.
// If compiler used via ndk-build or cmake (officially supported build methods)
Expand Down Expand Up @@ -2575,6 +2582,10 @@ impl Build {
}
}

if target.contains("msvc") && tool.family == ToolFamily::Gnu {
println!("cargo:warning=GNU compiler is not supported for this target");
}

Ok(tool)
}

Expand Down

0 comments on commit e84367b

Please sign in to comment.