Macro cargo_emit::rustc_link_arg_bin [−][src]
macro_rules! rustc_link_arg_bin {
(to : $stream : expr, $bin : expr => $flags : expr $(,) ?) => { ... };
(to : $stream : expr, $($bin : expr => $flags : expr), + $(,) ?) => { ... };
($bin : expr => $flags : expr $(,) ?) => { ... };
($($bin : expr => $flags : expr), + $(,) ?) => { ... };
}
Expand description
Tells Cargo to pass the -C link-arg=$flag
option to the compiler,
but only when building the binary target with name $bin
.
Its usage is highly platform specific.
It is useful to set a linker script or other linker options.
This is equivalent to:
println!("cargo:rustc-link-arg-bin=$bin=$flag");
Examples
cargo_emit::rustc_link_arg_bin!(
"hello_world" => "-Wall"
);
or, in case you want it to emit to a custom stream:
let mut stdout = std::io::stdout();
cargo_emit::rustc_link_arg_bin!(
to: stdout,
"hello_world" => "-Wall"
);