ExternalProject_Add(libzip
    DEPENDS zlib bzip2
    URL "https://libzip.org/download/libzip-1.4.0.tar.xz"
    URL_HASH SHA256=e508aba025f5f94b267d5120fc33761bcd98440ebe49dbfe2ed3df3afeacc7b1
    PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/libzip-fixes.patch
    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=RelWithDebInfo
        -DBUILD_SHARED_LIBS=OFF
    BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
    INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
    LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
)
