How can I tell cargo not to build an entire crate except on certain operating systems? The usual answer "just don't do that" doesn't apply, because this crate is part of a workspace and the rest of the workspace should be built on all operating systems. I want to use commands like cargo build --all
in CI, rather than running cargo build
separately for each crate. Ideally, I'd like to put something like this in the workspace's Cargo.toml
file:
[target.'cfg(unix)'.workspace]
members = ['foo', 'bar', 'baz']
[target.'cfg(not(unix))'.workspace]
members = ['foo', 'bar']
Has anybody else encountered this problem before? How did you fix it?