Skip to content

Commit e94a533

Browse files
committed
Don't use /usr as fallback sysroot on Windows
1 parent 81468be commit e94a533

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,17 @@ impl Library {
505505
let sysroot = config
506506
.env_var_os("PKG_CONFIG_SYSROOT_DIR")
507507
.or_else(|| config.env_var_os("SYSROOT"))
508-
.map(PathBuf::from)
509-
.unwrap_or_else(|| PathBuf::from("/usr"));
510-
vec![sysroot]
508+
.map(PathBuf::from);
509+
510+
if cfg!(target_os = "windows") {
511+
if let Some(sysroot) = sysroot {
512+
vec![sysroot]
513+
} else {
514+
vec![]
515+
}
516+
} else {
517+
vec![sysroot.unwrap_or_else(|| PathBuf::from("/usr"))]
518+
}
511519
};
512520

513521
let words = split_flags(output);

0 commit comments

Comments
 (0)