-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
If a crate has two features foo
and bar
which depend on each other, Cargo will error.
[features]
foo = ["bar"]
bar = ["foo"]
error: Cyclic feature dependency: feature `foo` depends on itself
However, I ended up needing this in winapi
. In order to allow people to compile only the bits they need to save time, winapi
has a feature for each header. Since headers depend on each other, the features in turn had to depend on each other to ensure that winapi
would compile correctly. Unfortunately sometimes those headers would have cyclic dependencies on each other, causing Cargo to complain. There were several workarounds I tried such as having a feature that is common to a set of headers which depend on each other, but I eventually settled on doing feature dependency resolution myself via a build script. https://github.com/retep998/winapi-rs/blob/dev/build.rs#L175-L191