Skip to content

Commit

Permalink
Merge pull request #249 from RalfJung/rustc-target
Browse files Browse the repository at this point in the history
propagate --target to rustc invocation
  • Loading branch information
dtolnay committed Aug 3, 2022
2 parents db32585 + da28e88 commit 29c72c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.rs
Expand Up @@ -71,7 +71,7 @@ fn compile_probe() -> Option<ExitStatus> {
fs::write(&probefile, PROBE).ok()?;

// Make sure to pick up Cargo rustc configuration.
let mut cmd = if let Some(wrapper) = env::var_os("CARGO_RUSTC_WRAPPER") {
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
let mut cmd = Command::new(wrapper);
// The wrapper's first argument is supposed to be the path to rustc.
cmd.arg(rustc);
Expand All @@ -89,6 +89,10 @@ fn compile_probe() -> Option<ExitStatus> {
.arg(out_dir)
.arg(probefile);

if let Some(target) = env::var_os("TARGET") {
cmd.arg("--target").arg(target);
}

// If Cargo wants to set RUSTFLAGS, use that.
if let Ok(rustflags) = env::var("CARGO_ENCODED_RUSTFLAGS") {
if !rustflags.is_empty() {
Expand Down

0 comments on commit 29c72c5

Please sign in to comment.