Skip to content

Commit 274732f

Browse files
use cc_env instead of path to set the CC configure variable (#244)
this allows wrappers like sccache to work properly
1 parent c591de6 commit 274732f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ impl Build {
387387
let mut cc = cc::Build::new();
388388
cc.target(target).host(host).warnings(false).opt_level(2);
389389
let compiler = cc.get_compiler();
390-
configure.env("CC", compiler.path());
390+
let mut cc_env = compiler.cc_env();
391+
if cc_env.is_empty() {
392+
cc_env = compiler.path().to_path_buf().into_os_string();
393+
}
394+
configure.env("CC", cc_env);
391395
let path = compiler.path().to_str().unwrap();
392396

393397
// Both `cc::Build` and `./Configure` take into account

0 commit comments

Comments
 (0)