#build-dependencies

build cmake

A build dependency for running cmake to build a native library

36 releases

0.1.35 Sep 30, 2018
0.1.33 Aug 14, 2018
0.1.31 May 3, 2018
0.1.29 Dec 7, 2017
0.1.1 Jul 31, 2015

#5 in Build Utils

Download history 15906/week @ 2018-10-17 18420/week @ 2018-10-24 16243/week @ 2018-10-31 17191/week @ 2018-11-07 17385/week @ 2018-11-14 17190/week @ 2018-11-21 16535/week @ 2018-11-28 15871/week @ 2018-12-05 15635/week @ 2018-12-12 14391/week @ 2018-12-19 12544/week @ 2018-12-26 16735/week @ 2019-01-02 18242/week @ 2019-01-09 24819/week @ 2019-01-16 18849/week @ 2019-01-23

69,317 downloads per month
Used in 348 crates (89 directly)

MIT/Apache

32KB
541 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 Serde 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

~113KB