Crate cargo_lib

Source
Expand description

§cargo-lib

Strongly-typed Cargo instructions for your build script.

§Usage

Add cargo-lib as a build dependency to be able to use it in your build.rs file:

[build-dependencies]
cargo-lib = "0.1"

Then in your build script:

use cargo_lib as cl;

fn main() {
    cl::warning("Running the build script");
    cl::rerun_if_env_changed("CC");
    // you can also use `None` for the second argument
    cl::rustc_link_search("/some/path", cl::SearchLibKind::Framework);
    cl::rustc_link_lib("MyFramework", cl::LibKind::Framework);
    cl::rustc_link_lib("c++", None);
}

Enums§

LibKind
LinkArgTarget
SearchLibKind

Functions§

metadata_set
Metadata, used by links scripts.
rerun_if_changed
Tells Cargo when to re-run the script.
rerun_if_env_changed
Tells Cargo when to re-run the script.
rustc_cfg
Enables compile-time cfg settings.
rustc_env
Sets an environment variable which can be accessed using var! macro
rustc_link_arg
Passes custom flags to a linker for benchmarks, binaries, cdylib crates, examples, and tests.
rustc_link_lib
Adds a library to link
rustc_link_search
Adds to the library search path.
warning
Displays a warning on the terminal.