boring-sys: Configure "rustc-cdylib-link-arg" only for macOS targets

cfg!() is evaluated for the host OS executing build.rs script.
What we need here is to look whether we are building *for* macOS.

Otherwise, for example, builds for iOS on macOS will try to add this
flag, causing warnings since rustc does not build cdylibs on iOS.
This commit is contained in:
ilammy 2021-12-30 19:52:39 +09:00 committed by Joshua Nelson
parent 11910f1e7c
commit 51e99ea9c0
1 changed files with 2 additions and 1 deletions

View File

@ -355,7 +355,8 @@ fn main() {
println!("cargo:rustc-link-lib=static=ssl"); println!("cargo:rustc-link-lib=static=ssl");
// MacOS: Allow cdylib to link with undefined symbols // MacOS: Allow cdylib to link with undefined symbols
if cfg!(target_os = "macos") { let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_os == "macos" {
println!("cargo:rustc-cdylib-link-arg=-Wl,-undefined,dynamic_lookup"); println!("cargo:rustc-cdylib-link-arg=-Wl,-undefined,dynamic_lookup");
} }