cargo_emit

Macro rustc_flags

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

Tells Cargo to pass $flags to the compiler.

As of this writing, only -l and -L flags are supported.

This is equivalent to:

println!("cargo:rustc-flags=$flags");

ยงExamples

The $flags get concatenated into a single formatting string. Formatting runtime values can be done by passing subsequent values.

cargo_emit::rustc_flags!("-l pthread");

or, in case you want it to emit to a custom stream:

let mut stdout = std::io::stdout();
cargo_emit::rustc_flags!(
    to: stdout,
    "-l pthread"
);