Always include target triple for output directory

I was wondering if it's possible to tell rust to always use the pattern target/<triple> as its output directory rather than a mix of target/release, target/debug, and target/<triple> for the output directory.

Bonus points if I don't have to create target configs for each triple that would be built.

  • Mike

There's no option for that. However, you could always pass --target arg, even when compiling natively.

@kornel , thank you for confirming. I was going to do that via a Makefile but I was wondering there was a way to use native cargo commands.

Yeah, it's annoying that there be no alias à la cargo build --target host.

I thus usually end up writing something along the lines of:

cargo build --target "$(rustc -vV | sed -nE 's/host: (.*)/\1/p')"

to "host-compile". Do note that this may also affect whether the RUSTFLAGS are passed to scripts and procedural macro crates.