4 releases

0.2.1 Sep 1, 2021
0.2.0 Aug 31, 2021
0.1.1 Dec 16, 2019
0.1.0 Dec 15, 2019

#69 in Build Utils

Download history 11124/week @ 2024-06-13 12869/week @ 2024-06-20 13849/week @ 2024-06-27 15760/week @ 2024-07-04 15231/week @ 2024-07-11 17416/week @ 2024-07-18 16998/week @ 2024-07-25 20054/week @ 2024-08-01 18074/week @ 2024-08-08 15174/week @ 2024-08-15 16800/week @ 2024-08-22 12082/week @ 2024-08-29 15424/week @ 2024-09-05 10417/week @ 2024-09-12 10030/week @ 2024-09-19 7493/week @ 2024-09-26

45,911 downloads per month
Used in 68 crates (30 directly)

MIT/Apache

47KB
824 lines

Cargo Emit

Crates.io Downloads Build Status rustc ^1.31.0
Become a Patron! Buy me a coffee

Talk to Cargo easily at build time, brought to you by Nikolai Vazquez.

This library provides:

  • Convenience macros for communicating with Cargo during the build.rs phrase. Cargo listens to certain build script outputs that dictate how it should behave.

  • An accessible location for seeing what script build outputs are available to emit.

  • Protection against typos that can be made when printing these formatted outputs directly yourself. Mistyping macro names will result in a compile failure.

Usage

This crate exposes the following macros:

Macro Output
pair!($key, $value) cargo:$key=$value
rerun_if_changed!($path) cargo:rerun-if-changed=$path
rerun_if_env_changed!($key) cargo:rerun-if-env-changed=$key
rustc_cdylib_link_arg!($flag) cargo:rustc-cdylib-link-arg=$flag
rustc_cfg!($feature) cargo:rustc-cfg=$feature
rustc_env!($key, $value) cargo:rustc-env=$key=$value
rustc_flags!($flags) cargo:rustc-flags=$flags
rustc_link_arg!($arg) cargo:rustc-link-arg=$arg
rustc_link_arg_bin!($bin => $arg) cargo:rustc-link-arg-bin=$bin=$arg
rustc_link_arg_bins!($arg) cargo:rustc-link-arg-bins=$arg
rustc_link_lib!($name => $kind) cargo:rustc-link-lib=$kind=$name
rustc_link_search!($path => $kind) cargo:rustc-link-search=$kind=$path
warning!($message) cargo:warning=$message

License

This project is released under either:

No runtime deps