From d9c5338547840e6e4775b9b9cc4d5dc34aa939f4 Mon Sep 17 00:00:00 2001 From: bryant Date: Wed, 24 May 2017 18:47:49 -0400 Subject: [PATCH] Pass to gcc-rs the selected CC/CXX via envvars. --- src/bootstrap/compile.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index c810a0e05d4d2..79877a4113092 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -277,6 +277,13 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) { if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) { cargo.env("CFG_LLVM_ROOT", s); } + // Set CC and CXX for crates that use extern crate gcc. + if let Some(s) = target_config.and_then(|c| c.cc.as_ref()) { + cargo.env("CC", s); + } + if let Some(s) = target_config.and_then(|c| c.cxx.as_ref()) { + cargo.env("CXX", s); + } // Building with a static libstdc++ is only supported on linux right now, // not for MSVC or macOS if build.config.llvm_static_stdcpp &&