diff --git a/src/build.rs b/src/build.rs index 50966c2..2d17d7a 100644 --- a/src/build.rs +++ b/src/build.rs @@ -121,7 +121,8 @@ fn main() { println!("[build] Started"); let have_snappy = env::var("CARGO_FEATURE_SNAPPY").is_ok(); - let is_bsd = env::var("TARGET").unwrap().ends_with("bsd"); + let target = env::var("TARGET").unwrap(); + let is_bsd = target.ends_with("bsd"); // If we have the appropriate feature, then we build snappy. if have_snappy { @@ -189,10 +190,9 @@ fn main() { }; println!("cargo:rustc-flags=-L native={} {}", out_dir, linker_flags); - let target = env::var("TARGET").unwrap(); - if target.contains("apple") { + if target.contains("apple") || target.contains("freebsd") { println!("cargo:rustc-link-lib=c++"); - } else if target.contains("gnu") { + } else if target.contains("gnu") || target.contains("netbsd") || target.contains("openbsd") { println!("cargo:rustc-link-lib=stdc++"); }