Skip to content

Commit d14c59d

Browse files
committed
Auto merge of #10674 - petrochenkov:linklib, r=ehuss
reference: Update syntax supported by `rustc-link-lib` This doc already contains a link below pointing to the relevant rustc documentation https://doc.rust-lang.org/nightly/rustc/command-line-arguments.html#-l-link-the-generated-crate-to-a-native-library which has the updated syntax.
2 parents 6d6dd9d + 53ec56c commit d14c59d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/doc/src/reference/build-scripts.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ one detailed below.
106106
flags to a linker for examples.
107107
* [`cargo:rustc-link-arg-benches=FLAG`](#rustc-link-arg-benches) – Passes custom
108108
flags to a linker for benchmarks.
109-
* [`cargo:rustc-link-lib=[KIND=]NAME`](#rustc-link-lib) — Adds a library to
109+
* [`cargo:rustc-link-lib=LIB`](#rustc-link-lib) — Adds a library to
110110
link.
111111
* [`cargo:rustc-link-search=[KIND=]PATH`](#rustc-link-search) — Adds to the
112112
library search path.
@@ -153,12 +153,16 @@ to set a linker script or other linker options.
153153

154154

155155
<a id="rustc-link-lib"></a>
156-
#### `cargo:rustc-link-lib=[KIND=]NAME`
156+
#### `cargo:rustc-link-lib=LIB`
157157

158158
The `rustc-link-lib` instruction tells Cargo to link the given library using
159159
the compiler's [`-l` flag][option-link]. This is typically used to link a
160160
native library using [FFI].
161161

162+
The `LIB` string is passed directly to rustc, so it supports any syntax that
163+
`-l` does. \
164+
Currently the full supported syntax for `LIB` is `[KIND[:MODIFIERS]=]NAME[:RENAME]`.
165+
162166
The `-l` flag is only passed to the library target of the package, unless
163167
there is no library target, in which case it is passed to all targets. This is
164168
done because all other targets have an implicit dependency on the library

0 commit comments

Comments
 (0)