File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,20 +41,19 @@ elseif(DEFINED ENV{MSYSTEM})
4141
4242 find_package (ICU OPTIONAL_COMPONENTS i18n uc data )
4343 find_package (JPEG REQUIRED )
44-
45- # Find ZLIB first to control linking order
46- find_package (ZLIB REQUIRED )
4744 find_package (PNG REQUIRED )
45+ find_package (PkgConfig REQUIRED )
4846
49- # For MSYS2, ensure PNG uses static zlib only
50- if (TARGET PNG::PNG AND TARGET ZLIB::ZLIB)
47+ # Fix zlib conflicts in MSYS2 builds
48+ if (TARGET PNG::PNG)
49+ # Get the actual PNG libraries from pkg-config to avoid zlib conflicts
50+ pkg_check_modules (PNG_PC libpng REQUIRED )
5151 set_target_properties (PNG::PNG PROPERTIES
52- INTERFACE_LINK_LIBRARIES "ZLIB::ZLIB"
52+ INTERFACE_LINK_LIBRARIES "${PNG_PC_LINK_LIBRARIES} "
53+ INTERFACE_INCLUDE_DIRECTORIES "${PNG_PC_INCLUDE_DIRS} "
5354 )
5455 endif ()
5556
56- find_package (PkgConfig REQUIRED )
57-
5857 pkg_search_module (WEBP libwebp REQUIRED )
5958 pkg_search_module (LIBUV libuv REQUIRED )
6059 pkg_search_module (CURL libcurl REQUIRED )
You can’t perform that action at this time.
0 commit comments