Skip to content

Commit e497e32

Browse files
committed
Auto merge of #8809 - roblabla:patch-1, r=ehuss
Document platform-specific build-dependencies It turns out that `target.'cfg()'.build-dependencies` are a currently stable but undocumented feature. This PR mentions it in the cargo reference.
2 parents 6db62a7 + 2b2f044 commit e497e32

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/doc/src/reference/specifying-dependencies.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,19 @@ manifest:
346346
cc = "1.0.3"
347347
```
348348

349+
350+
You can also have target-specific build dependencies by using
351+
`build-dependencies` in the target section header instead of `dependencies`. For
352+
example:
353+
354+
```toml
355+
[target.'cfg(unix)'.build-dependencies]
356+
cc = "1.0.3"
357+
```
358+
359+
In this case, the dependency will only be built when the host platform matches the
360+
specified target.
361+
349362
The build script **does not** have access to the dependencies listed
350363
in the `dependencies` or `dev-dependencies` section. Build
351364
dependencies will likewise not be available to the package itself

0 commit comments

Comments
 (0)