I've got a crate that can be compiled with or without a feature, let's say feat_crate
.
I use that crate from a program that can also be compiled with or without a feature feat_app
.
I'd like to enable feat_crate
for the dependency whenever feat_app
is enabled; feat_app
being enabled when building the app (like in cargo run -- --feat_app
⚠ EDIT, like in cargo run --features feat_app
).
I cannot find a simple way to do so without modifying the Cargo.toml
file each time I want to change the enabled feature. I tried looking at build scripts but the script for the app is executed after the dependencies are compiled, so it doesn't seem to help.
I probably can use an environment variable fetched from the crate build script, meaning I would have to set that environment variable accordingly... but I was hoping for a better solution.