Dear Rustaceans, I am stuck with the following problem.
I have a workspace containing several crates organized like this:
Top level Cargo.toml
:
[workspace]
members = [
"molar",
"molar_python",
...
...
]
The crate molar
has a feature gromacs
, which turns on conditional compilation in several places and activates another dependency.
molar/Cargo.toml
:
[features]
gromacs = ["dep:molar_gromacs"]
Now, when I'm compiling molar_python
, which depends on molar
, I want to propagate gromacs
feature down to molar
like this:
molar_python/Cargo.toml
:
[dependencies]
molar = {version = "0.8.0", path = "../molar", default-features = false}
...
[features]
gromacs = ["molar/gromacs"]
The idea is that when I do cargo build -p molar_python --features=gromacs
the feature is propagated to molar
crate, switches on the same feature there and sets all conditinal compilation properly. At least it should work like this according to the manual.
However, it doesn't work at all. Whatever I do I can't activate gromacs
feature in molar
crate indirectly from molar_python
. The only way is to explicitly making it default
in crate molar
and removing default-features=flase
in molar_python
.
Am I missing something obvious? What is the correct way of doing this?
This happens in my molar crate.