libpng package: find correct zlib library on Windows (#49034)

This explicitly specifies the correct library for zlib to CMake:

CMake's find zlib looks for zlib before zdll. On Windows, zlib is the
static lib, and zdll the import library. LibPNG only links to shared
zlib, but was getting zlib from CMake on Windows, which was resulting
in a linker failure.
This commit is contained in:
John W. Parent 2025-04-04 20:58:05 -04:00 committed by GitHub
parent 924204828e
commit f8524f9d5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,6 +62,9 @@ def cmake_args(self):
self.define("PNG_STATIC", "static" in self.spec.variants["libs"].value),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
]
zlib_lib = self.spec["zlib-api"].libs
if zlib_lib:
args.append(self.define("ZLIB_LIBRARY", zlib_lib[0]))
if self.spec.satisfies("platform=darwin target=aarch64:"):
args.append("-DPNG_ARM_NEON=off")
return args