Skip to content

Commit 29c72c5

Browse files
authored
Merge pull request #249 from RalfJung/rustc-target
propagate --target to rustc invocation
2 parents db32585 + da28e88 commit 29c72c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn compile_probe() -> Option<ExitStatus> {
7171
fs::write(&probefile, PROBE).ok()?;
7272

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

92+
if let Some(target) = env::var_os("TARGET") {
93+
cmd.arg("--target").arg(target);
94+
}
95+
9296
// If Cargo wants to set RUSTFLAGS, use that.
9397
if let Ok(rustflags) = env::var("CARGO_ENCODED_RUSTFLAGS") {
9498
if !rustflags.is_empty() {

0 commit comments

Comments
 (0)