Skip to content

Commit cf0ec8a

Browse files
committed
Fix default for c++ std lib env var
1 parent dda6d2c commit cf0ec8a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

build.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ fn main() {
99
println!("cargo:rustc-link-search=native={}", custom_lib_dir);
1010
println!("cargo:rustc-link-lib=static={}", custom_lib_name);
1111

12-
// Allow user to specify use of LLVM or GCC C++ stdlib, or none.
13-
// "cargo:rustc-link-lib=stdc++" is used by default for
14-
// backward-compatibility.
15-
// Note: google/oss-fuzz uses LLVM C++ stdlib as of 15 Jan 2020
16-
if let Ok(std_cxx_flag) = ::std::env::var("CUSTOM_LIBFUZZER_STD_CXX") {
17-
match std_cxx_flag.as_str() {
18-
"c++" => println!("cargo:rustc-link-lib=c++"),
19-
"stdc++" => println!("cargo:rustc-link-lib=stdc++"),
20-
"none" => (),
21-
_ => println!("cargo:rustc-link-lib=stdc++"),
22-
}
12+
match std::env::var("CUSTOM_LIBFUZZER_STD_CXX") {
13+
// Default behavior for backwards compat.
14+
Err(_) => println!("cargo:rustc-link-lib=stdc++"),
15+
Ok(s) if s == "none" => (),
16+
Ok(s) => println!("cargo:rustc-link-lib={}", s),
2317
}
2418
} else {
2519
let mut build = cc::Build::new();

0 commit comments

Comments
 (0)