I have a virtual workspace consisting of many crates, and some of the crates have their own features. My top-level Cargo.toml
file is:
[workspace]
members = [ "crate1", "crate2", "crate3"]
[features]
featA = [ "crate1/featA", "crate2/featA" ]
featB = [ "crate3/featB" ]
I'm trying to issue a command like cargo build --features "featA"
in the top-level workspace directory and have it build both crate1
and crate2
with featA
enabled.
However, when I run this, none of the features are ever enabled. This style of feature selection syntax was working beforehand when I was using a different project layout with a single "parent" crate, but the virtual workspace feature is way better for my use case, aside from this feature not working.
What is the proper way to have a top-level workspace Cargo.toml
file with features that enable its subcrates' features?
Thanks!