cargo_emit

Macro rustc_link_search

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

Tells Cargo to pass $path to the compiler as a -L flag.

This is equivalent to:

println!("cargo:rustc-link-search=[$kind=]$path");

ยงExamples

Useful for telling the linker where a path can be found.

cargo_emit::rustc_link_search!(
    "path/to/ssl/lib/", // same as `=> "all"`
    "path/to/ruby/lib/" => "native",
);

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

let mut stdout = std::io::stdout();
cargo_emit::rustc_link_search!(
    to: stdout,
    "path/to/ssl/lib/", // same as `=> "all"`
    "path/to/ruby/lib/" => "native",
);