-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationC-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-add
Description
Problem
Currently, there is no support for adding platform specific dependencies (such as [target.'cfg(windows)'.dependencies]) using cargo add.
Proposed Solution
Add a --cfg option that allows the user to specify the whole desired cfg predicate.
Examples:
cargo add windows --cfg windowscargo add raw_cpuid --cfg any(target_arch = "x86", target_arch = "x86_64")
Notes
- Currently, since
cfgdependency specifications only are supported using platform predicates, one might think that the option should be named differently. But, in case othercfgpairs/options become supported in the future, the name of the flag allows for it to also include those without confusion for its name being named after the fact it specifies platform specific dependencies only.
Metadata
Metadata
Assignees
Labels
A-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationC-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-add