Function emit_link_directives

pub fn emit_link_directives<P: AsRef<Path>>(build: &Build, library: P)

Emit the cargo: lines that link a static library into the crate being built, the way Build::compile does after creating its archive.

library is the path of the library, such as the one returned by Build::create_archive, including its folder. Its file name must be lib<name>.a, or <name>.lib on MSVC targets. The library is linked as <name>, and its folder is added to the native library search path.

build provides the target and the settings that decide how it is linked and which other libraries are linked with it, such as Build::link_lib_modifier, Build::cpp with Build::cpp_link_stdlib, and Build::cudart. The lines are not printed when Build::cargo_metadata is off.

Panics

Panics if library has no folder or its file name doesn't have one of the forms above, or if the libraries to link with it can't be determined.