Windows: fix handling of .zip files

If set(ZLIB_INCLUDE_PATH value) is called without setting cache,
and find_package(zlib) is called twice, the second call fails.
Behavior described here: https://gitlab.kitware.com/cmake/cmake/-/issues/21343

It seems that the new libcurl version also calls find_package(zlib)
so the second call by libarchive fails. And without zlib support
handling .zip files that use deflate compression does not work.

Only affected Windows, because we are only using a bundled zlib
there.
On Linux system libarchive and system zlib is used.
On Mac OS X bundled libarchive, but system zlib is used.

Ref #586
This commit is contained in:
Floris Bos 2023-05-22 10:46:28 +02:00
parent e490ec1c4d
commit 60c53db98c

View file

@ -178,7 +178,7 @@ if (WIN32)
# Bundled zlib
add_subdirectory(dependencies/zlib-1.2.13)
set(ZLIB_LIBRARY zlibstatic)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.2.13)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies/zlib-1.2.13 CACHE PATH "zlib include dir")
# Bundled libcurl
set(CMAKE_CURL_INCLUDES)