From: Joel Rosdahl Date: Sun, 25 Feb 2024 09:34:02 +0000 (+0100) Subject: build: Move CMake configuration of dependencies to a separate file X-Git-Tag: v4.10~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74bbc269b0ae35089a57e9d565d905579c8d202d;p=thirdparty%2Fccache.git build: Move CMake configuration of dependencies to a separate file --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a769cbf..3e70e94f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,37 +78,12 @@ include(EnableCcache) # Configuration # +option(REDIS_STORAGE_BACKEND "Enable Redis remote storage" ON) + include(InstallDirs) include(GenerateConfigurationFile) include(GenerateVersionFile) - -# -# Third party -# - -set(ZSTD_FROM_INTERNET AUTO CACHE STRING "Download and use libzstd from the Internet") -set_property(CACHE ZSTD_FROM_INTERNET PROPERTY STRINGS AUTO ON OFF) - -set(HIREDIS_FROM_INTERNET AUTO CACHE STRING "Download and use libhiredis from the Internet") -set_property(CACHE HIREDIS_FROM_INTERNET PROPERTY STRINGS AUTO ON OFF) - -option( - OFFLINE "Do not download anything from the internet" - "$(FETCHCONTENT_FULLY_DISCONNECTED}" -) -if(OFFLINE) - set(FETCHCONTENT_FULLY_DISCONNECTED ON) - set(ZSTD_FROM_INTERNET OFF) - set(HIREDIS_FROM_INTERNET OFF) -endif() - -find_package(zstd 1.1.2 MODULE REQUIRED) - -option(REDIS_STORAGE_BACKEND "Enable Redis remote storage" ON) - -if(REDIS_STORAGE_BACKEND) - find_package(hiredis 0.13.3 MODULE REQUIRED) -endif() +include(Dependencies) # # Special flags diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 00000000..37240527 --- /dev/null +++ b/cmake/Dependencies.cmake @@ -0,0 +1,26 @@ +if(POLICY CMP0135) + # Set timestamps on extracted files to time of extraction. + cmake_policy(SET CMP0135 NEW) +endif() + +set(ZSTD_FROM_INTERNET AUTO CACHE STRING "Download and use libzstd from the Internet") +set_property(CACHE ZSTD_FROM_INTERNET PROPERTY STRINGS AUTO ON OFF) + +set(HIREDIS_FROM_INTERNET AUTO CACHE STRING "Download and use libhiredis from the Internet") +set_property(CACHE HIREDIS_FROM_INTERNET PROPERTY STRINGS AUTO ON OFF) + +option( + OFFLINE "Do not download anything from the internet" + "$(FETCHCONTENT_FULLY_DISCONNECTED}" +) +if(OFFLINE) + set(FETCHCONTENT_FULLY_DISCONNECTED ON) + set(ZSTD_FROM_INTERNET OFF) + set(HIREDIS_FROM_INTERNET OFF) +endif() + +find_package(zstd 1.1.2 MODULE REQUIRED) + +if(REDIS_STORAGE_BACKEND) + find_package(hiredis 0.13.3 MODULE REQUIRED) +endif() diff --git a/cmake/Findhiredis.cmake b/cmake/Findhiredis.cmake index 6374c347..9a72a309 100644 --- a/cmake/Findhiredis.cmake +++ b/cmake/Findhiredis.cmake @@ -2,11 +2,6 @@ if(hiredis_FOUND) return() endif() -if(POLICY CMP0135) - # Set timestamps on extracted files to time of extraction. - cmake_policy(SET CMP0135 NEW) -endif() - set(hiredis_FOUND FALSE) if(HIREDIS_FROM_INTERNET AND NOT HIREDIS_FROM_INTERNET STREQUAL "AUTO") diff --git a/cmake/Findzstd.cmake b/cmake/Findzstd.cmake index dd69351d..c409a0df 100644 --- a/cmake/Findzstd.cmake +++ b/cmake/Findzstd.cmake @@ -2,11 +2,6 @@ if(zstd_FOUND) return() endif() -if(POLICY CMP0135) - # Set timestamps on extracted files to time of extraction. - cmake_policy(SET CMP0135 NEW) -endif() - set(zstd_FOUND FALSE) if(ZSTD_FROM_INTERNET AND NOT ZSTD_FROM_INTERNET STREQUAL "AUTO")