macro_rules! rustc_link_arg {
(to: $stream:expr, $($flag:expr),+ $(,)?) => { ... };
($($flag:expr),+ $(,)?) => { ... };
}
Expand description
Tells Cargo to pass the -C link-arg=FLAG option to the compiler, but only when building supported targets (benchmarks, binaries, cdylib crates, examples, and tests). Its usage is highly platform specific. It is useful to set the shared library version or linker script.
This is equivalent to:
println!("cargo:rustc-link-arg=$flag");
ยงExamples
let flag1 = // ...
let flag2 = // ...
cargo_emit::rustc_link_arg!(
flag1, flag2
);
or, in case you want it to emit to a custom stream:
let flag1 = // ...
let flag2 = // ...
let mut stdout = std::io::stdout();
cargo_emit::rustc_link_arg!(
to: stdout,
flag1, flag2
);