summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRafael Kitover <rkitover@gmail.com>2022-07-19 01:29:27 -0700
committerGitHub <noreply@github.com>2022-07-19 10:29:27 +0200
commit2c742c2c7ca988f9a6c57cee72835d62be30b451 (patch)
tree30907ea4c105a69547c70f710950d120628cbd49 /CMakeLists.txt
parent7ee6030bc7b2e6ef321c01854f88ce0fd81c4513 (diff)
downloadccache-2c742c2c7ca988f9a6c57cee72835d62be30b451.tar.gz
feat: Download dependencies from the Internet when unavailable (#1112)
Change the behavior of ZSTD_FROM_INTERNET and HIREDIS_FROM_INTERNET to always be on and only come into affect when the package is not found on the system by normal means. Also use the cmake standard module FetchContent for the download/checksum/unpack logic. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 5 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c54c4f01..06478719 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,21 +109,16 @@ endif()
#
# Third party
#
-set(HIREDIS_FROM_INTERNET_DEFAULT OFF)
-set(ZSTD_FROM_INTERNET_DEFAULT OFF)
+option(ZSTD_FROM_INTERNET
+ "Download and use libzstd from the Internet if not available" ON)
+option(HIREDIS_FROM_INTERNET
+ "Download and use libhiredis from the Internet if not available" ON)
-# Default to downloading deps for Visual Studio, unless using a package manager.
-if(MSVC AND NOT CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg|conan")
- set(HIREDIS_FROM_INTERNET_DEFAULT ON)
- set(ZSTD_FROM_INTERNET_DEFAULT ON)
-endif()
-
-option(ZSTD_FROM_INTERNET "Download and use libzstd from the Internet" ${ZSTD_FROM_INTERNET_DEFAULT})
find_package(zstd 1.1.2 MODULE REQUIRED)
option(REDIS_STORAGE_BACKEND "Enable Redis secondary storage" ON)
+
if(REDIS_STORAGE_BACKEND)
- option(HIREDIS_FROM_INTERNET "Download and use libhiredis from the Internet" ${HIREDIS_FROM_INTERNET_DEFAULT})
find_package(hiredis 0.13.3 MODULE REQUIRED)
endif()