Build settings for all crates in a workspace?

Hello,

I have a top-level Cargo.toml with workspace definitions and then individual crates that use common dependencies etc.

Is there a way to specify [build] with rustflags for all crates in such a workspace?

I tried adding a [build] section but cargo tells me unused manifest key: build.

The [build] section goes in .cargo/config.toml, not Cargo.toml.[1]


  1. Note that this technically doesn't apply to the workspace at all, but rather the directory where you ran the cargo build command. These are usually the same, but not if you use cargo build --manifest-path=.... ↩ī¸Ž

2 Likes

Ah ok thanks!