Skip to content

Commit c3bbb2f

Browse files
committed
Update windows.cmake
1 parent d97b296 commit c3bbb2f

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

platform/windows/windows.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)