Dependency for specific platforms or feature-enabled

A dependency for a specific platform can be achieved with e.g.:

foo = "0.1"

A feature-enabled dependency can be achieved with e.g.:

version = "0.1"
optional = true

feature = ["dep:foo"]

How can you combine both? That is, a dependency that is enabled by default on one platform, but can be enabled on all platforms via a feature?

I found a way that involves an intermediate crate...

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.