Skip to content

Commit

Permalink
Set DEP_Z_INCLUDE for zlib from vcpkg
Browse files Browse the repository at this point in the history
DEP_Z_INCLUDE is already set when zlib is found via pkg-config, so let's do it for vcpkg too.
This is useful for other build script to be able to get include dir of zlib in more cases, instead of doing queries themself.
  • Loading branch information
sagudev committed Jul 12, 2024
1 parent 50dfd55 commit 42c7104
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,17 @@ fn try_vcpkg() -> bool {
.emit_includes(true)
.find_package("zlib")
{
Ok(_) => true,
Ok(zlib) => {
if !zlib.include_paths.is_empty() {
let paths = zlib
.include_paths
.iter()
.map(|s| s.display().to_string())
.collect::<Vec<_>>();
println!("cargo:include={}", paths.join(","));
}
true
}
Err(e) => {
println!("note, vcpkg did not find zlib: {}", e);
false
Expand Down

0 comments on commit 42c7104

Please sign in to comment.