cargo_emit

Macro rustc_cdylib_link_arg

Source
macro_rules! rustc_cdylib_link_arg {
    (to: $stream:expr, $($flag:expr),+ $(,)?) => { ... };
    ($($flag:expr),+ $(,)?) => { ... };
}
Expand description

Tells Cargo to pass -C link-arg=$flag to the compiler.

This is equivalent to:

println!("cargo:rustc-cdylib-link-arg=$flag");

ยงExamples

Runtime arguments can be passed directly.

let flag1 = // ...
let flag2 = // ...
cargo_emit::rustc_cdylib_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_cdylib_link_arg!(
    to: stdout,
    flag1, flag2
);