#build-dependencies

build cmake

A build dependency for running cmake to build a native library

41 releases

0.1.40 May 14, 2019
0.1.38 Apr 5, 2019
0.1.37 Mar 28, 2019
0.1.35 Sep 30, 2018
0.1.1 Jul 31, 2015

#3 in Build Utils

Download history 17783/week @ 2019-01-29 21681/week @ 2019-02-05 19635/week @ 2019-02-12 19407/week @ 2019-02-19 19828/week @ 2019-02-26 20175/week @ 2019-03-05 20002/week @ 2019-03-12 17153/week @ 2019-03-19 20938/week @ 2019-03-26 23540/week @ 2019-04-02 23269/week @ 2019-04-09 18117/week @ 2019-04-16 20031/week @ 2019-04-23 18954/week @ 2019-04-30 19151/week @ 2019-05-07

89,248 downloads per month
Used in 440 crates (119 directly)

MIT/Apache

34KB
588 lines

cmake

Build Status

Documentation

A build dependency for running the cmake build tool to compile a native library.

# Cargo.toml
[build-dependencies]
cmake = "0.1"

The CMake executable is assumed to be cmake unless the CMAKE environmental variable is set.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in cmake by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

A build dependency for running cmake to build a native library

This crate provides some necessary boilerplate and shim support for running the system cmake command to build a native library. It will add appropriate cflags for building code to link into Rust, handle cross compilation, and use the necessary generator for the platform being targeted.

The builder-style configuration allows for various variables and such to be passed down into the build as well.

Installation

Add this to your Cargo.toml:

[build-dependencies]
cmake = "0.1"

Examples

use cmake;

// Builds the project in the directory located in `libfoo`, installing it
// into $OUT_DIR
let dst = cmake::build("libfoo");

println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=foo");
use cmake::Config;

let dst = Config::new("libfoo")
                 .define("FOO", "BAR")
                 .cflag("-foo")
                 .build();
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=foo");

Dependencies

~112KB