From 4af06fd487e896e5ad162bea1d53a390f90151c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joshua=20Vanda=C3=ABle?= Date: Wed, 24 Dec 2025 04:59:08 +0100 Subject: [PATCH] minizip-ng: Properly use libraries from Externals This also fixes the CMake build on Windows, since it would fail to find our target defined in Externals and would fall back to trying to redefine it, which produces an error. --- CMakeLists.txt | 16 ++++++------- Externals/minizip-ng/CMakeLists.txt | 35 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 170b7e0632..b3f27e994f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -658,6 +658,13 @@ if(NOT (WIN32 AND _M_ARM_64)) add_definitions(-DHAS_OPENGL) endif() +if(NOT WIN32) + if(ANDROID) + set(USE_SYSTEM_Iconv OFF) + endif() + dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14) +endif() + dolphin_find_optional_system_library(pugixml Externals/pugixml) dolphin_find_optional_system_library_pkgconfig(ENET libenet>=1.3.18 enet::enet Externals/enet) @@ -718,15 +725,6 @@ dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28) dolphin_find_optional_system_library(CURL Externals/curl) -if(NOT WIN32) - if(NOT ANDROID) - dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14) - else() - message(STATUS "Using static iconv from Externals") - add_subdirectory(Externals/libiconv EXCLUDE_FROM_ALL) - endif() -endif() - if(NOT ANDROID) dolphin_find_optional_system_library(HIDAPI Externals/hidapi) endif() diff --git a/Externals/minizip-ng/CMakeLists.txt b/Externals/minizip-ng/CMakeLists.txt index adf2611841..9e7d41cbbf 100644 --- a/Externals/minizip-ng/CMakeLists.txt +++ b/Externals/minizip-ng/CMakeLists.txt @@ -3,7 +3,42 @@ set(MZ_BUILD_TESTS OFF) set(MZ_BUILD_UNIT_TESTS OFF) set(MZ_BUILD_FUZZ_TESTS OFF) set(MZ_CODE_COVERAGE OFF) +set(MZ_FETCH_LIBS OFF) +set(MZ_BZIP2 OFF) +set(MZ_PKCRYPT OFF) +set(MZ_WZAES OFF) +set(MZ_OPENSSL OFF) +set(MZ_LIBBSD OFF) set(SKIP_INSTALL_ALL ON) +if(Iconv_TYPE STREQUAL Bundled) + set(CMAKE_DISABLE_FIND_PACKAGE_Iconv TRUE) + set(Iconv_FOUND TRUE) + set(Iconv_LIBRARIES Iconv::Iconv) + get_target_property(Iconv_INCLUDE_DIRS ${Iconv_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES) +endif() +if(LibLZMA_TYPE STREQUAL Bundled) + set(CMAKE_DISABLE_FIND_PACKAGE_LibLZMA TRUE) + set(LIBLZMA_FOUND TRUE) + set(LIBLZMA_LIBRARIES LibLZMA::LibLZMA) + get_target_property(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES) +endif() +if(ZLIB_TYPE STREQUAL Bundled) + set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB TRUE) + set(ZLIB_FOUND TRUE) + set(ZLIB_LIBRARIES ZLIB::ZLIB) + get_target_property(ZLIB_INCLUDE_DIRS ${ZLIB_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES) +endif() +if(ZSTD_TYPE STREQUAL Bundled) + set(CMAKE_DISABLE_FIND_PACKAGE_ZSTD TRUE) + set(ZSTD_FOUND TRUE) + set(ZSTD_LIBRARIES zstd::zstd) + get_target_property(ZSTD_INCLUDE_DIRS ${ZSTD_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES) +endif() + +# minizip-ng otherwise uses system libraries when we provide them above +set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig TRUE) +set(PKGCONFIG_FOUND FALSE) + add_subdirectory(minizip-ng) dolphin_disable_warnings(minizip-ng)