Browse Source

Disable default args when they may conflict with CFLAGS/CXXFLAGS

urgh
George Hahn 6 years ago
parent
commit
c694baec33
  1. 9
      src/lib.rs

9
src/lib.rs

@ -1098,8 +1098,13 @@ impl Build {
cmd.push_cc_arg(arg.into());
}
// Disable default flag generation via environment variable
let use_defaults = self.getenv("CRATE_CC_NO_DEFAULTS").is_none();
// Disable default flag generation via environment variable or when
// certain cross compiling arguments are set
let use_defaults = self.getenv("CRATE_CC_NO_DEFAULTS").is_none()
&& !(cmd.args.iter().any(|ref a| {
let arg = a.to_str().unwrap_or("");
arg.starts_with("-m") || arg.starts_with("/arch") || arg.starts_with("--target")
}));
if use_defaults {
// Non-target flags

Loading…
Cancel
Save