Skip to content

Commit 9208781

Browse files
committed
Set static_crt to gcc::Config only if it was set to cmake::Config
1 parent 0188766 commit 9208781

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/lib.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,26 @@ impl Config {
237237
getenv_unwrap("HOST")
238238
});
239239
let msvc = target.contains("msvc");
240-
let c_compiler = gcc::Config::new().cargo_metadata(false)
241-
.opt_level(0)
242-
.debug(false)
243-
.target(&target)
244-
.host(&host)
245-
.static_crt(self.static_crt.unwrap_or(false))
246-
.get_compiler();
247-
let cxx_compiler = gcc::Config::new().cargo_metadata(false)
248-
.cpp(true)
249-
.opt_level(0)
250-
.debug(false)
251-
.target(&target)
252-
.host(&host)
253-
.static_crt(self.static_crt.unwrap_or(false))
254-
.get_compiler();
240+
let mut c_cfg = gcc::Config::new();
241+
c_cfg.cargo_metadata(false)
242+
.opt_level(0)
243+
.debug(false)
244+
.target(&target)
245+
.host(&host);
246+
let mut cxx_cfg = gcc::Config::new();
247+
cxx_cfg.cargo_metadata(false)
248+
.cpp(true)
249+
.opt_level(0)
250+
.debug(false)
251+
.target(&target)
252+
.host(&host);
253+
if let Some(static_crt) = self.static_crt {
254+
c_cfg.static_crt(static_crt);
255+
cxx_cfg.static_crt(static_crt);
256+
}
257+
258+
let c_compiler = gcc::Config::new().get_compiler();
259+
let cxx_compiler = gcc::Config::new().get_compiler();
255260

256261
let dst = self.out_dir.clone().unwrap_or_else(|| {
257262
PathBuf::from(getenv_unwrap("OUT_DIR"))

0 commit comments

Comments
 (0)