-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Different default targets for cargo build and cargo test? #6784
Copy link
Copy link
Closed as not planned
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-testS-propose-closeStatus: A team member has nominated this for closing, pending further input from the teamStatus: A team member has nominated this for closing, pending further input from the team
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-testS-propose-closeStatus: A team member has nominated this for closing, pending further input from the teamStatus: A team member has nominated this for closing, pending further input from the team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done
Describe the problem you are trying to solve
Cargo currently provides a
build.targetconfiguration key that allows to change the default target triple. This changes the default target for all cargo commands, includingcargo build,cargo run,cargo testandcargo bench. For embedded/OS crates it often makes sense to set that key so that the project is automatically built for the bare-metal target system instead of the host system.The problem is that one might still want to run the
cargo testandcargo benchcommands on the host architecture because they depend onstd(and thus don't work on the embedded target). Currently the only way to do this is to specify the full host triple on eachcargo testinvocation, which is not portable across different host systems.Describe the solution you'd like
It would be nice if there would be an additional
build.build-targetconfiguration key that overrides the target only forcargo build,cargo check, andcargo run, but not forcargo testandcargo bench.Notes
I'm happy to create a PR for this if something like this is desired.