Skip to content

Commit

Permalink
Merge pull request #1991 from micolous/issue1984
Browse files Browse the repository at this point in the history
Allow running pkg-config when targetting windows from non-windows hosts
  • Loading branch information
sfackler authored Jul 6, 2023
2 parents 0f0bbe4 + 8de2783 commit e8f0443
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions openssl-sys/build/find_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,13 @@ https://github.com/sfackler/rust-openssl#windows
/// typically tells us all the information that we need.
fn try_pkg_config() {
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();

// If we're going to windows-gnu we can use pkg-config, but only so long as
// we're coming from a windows host.
//
// Otherwise if we're going to windows we probably can't use pkg-config.
if target.contains("windows-gnu") && host.contains("windows") {
// If we're using mingw (windows-gnu*), we can use pkg-config, but we need
// to allow mismatched host/target.
if target.contains("windows-gnu") {
env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
} else if target.contains("windows") {
// MSVC targets use vcpkg instead.
return;
}

Expand Down

0 comments on commit e8f0443

Please sign in to comment.