diff --git a/taskwarrior-sys/build.rs b/taskwarrior-sys/build.rs index 77dd28d..15e2d01 100644 --- a/taskwarrior-sys/build.rs +++ b/taskwarrior-sys/build.rs @@ -40,7 +40,14 @@ fn main() { println!("cargo:rustc-link-lib=static=libshared"); println!("cargo:rustc-link-lib=static=columns"); println!("cargo:rustc-link-lib=static=commands"); - println!("cargo:rustc-link-lib=c++"); + + let target_os = env::var("CARGO_CFG_TARGET_OS"); + match target_os.as_deref() { + Ok("linux") => println!("cargo:rustc-link-lib=stdc++"), + Ok("macos") => println!("cargo:rustc-link-lib=c++"), + Ok(target) => panic!("not sure how to link on {target}"), + Err(e) => panic!("Not able to determine target due to {e}"), + } println!("cargo:rustc-link-search=native=/opt/homebrew/opt/gnutls/lib"); println!("cargo:rustc-link-lib=dylib=gnutls");