From c5be04fe591ec325c50610a5765cbec58a8cf105 Mon Sep 17 00:00:00 2001 From: doy-materialize <110416385+doy-materialize@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:12:06 -0400 Subject: [PATCH] use cc_env instead of path to set the CC configure variable this allows wrappers like sccache to work properly --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 10db4c68..dd9d7bd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -387,7 +387,11 @@ impl Build { let mut cc = cc::Build::new(); cc.target(target).host(host).warnings(false).opt_level(2); let compiler = cc.get_compiler(); - configure.env("CC", compiler.path()); + let mut cc_env = compiler.cc_env(); + if cc_env.is_empty() { + cc_env = compiler.path().to_path_buf().into_os_string(); + } + configure.env("CC", cc_env); let path = compiler.path().to_str().unwrap(); // Both `cc::Build` and `./Configure` take into account