diff --git a/Cargo.toml b/Cargo.toml index 720802e0a0..b2287c9f13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ path = "lib.rs" [build-dependencies] cmake = "0.1" +pkg-config = "0.3" [features] wayland = [] diff --git a/build.rs b/build.rs index d0a2bde920..45b60647e6 100644 --- a/build.rs +++ b/build.rs @@ -1,7 +1,15 @@ extern crate cmake; +extern crate pkg_config; + use cmake::Config; fn main() { + if let Ok(_library) = pkg_config::probe_library("glfw3") { + // We got the library via pkg_config, we don't need to try and build it + // below. + return; + } + let mut cfg = Config::new("glfw"); cfg.define("GLFW_BUILD_EXAMPLES", "OFF")