]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build: Move CMake configuration of dependencies to a separate file
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Feb 2024 09:34:02 +0000 (10:34 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 16 Mar 2024 20:54:53 +0000 (21:54 +0100)
CMakeLists.txt
cmake/Dependencies.cmake [new file with mode: 0644]
cmake/Findhiredis.cmake
cmake/Findzstd.cmake

index 0a769cbfc70ab0b693d741d07a5a1fb70af94178..3e70e94f3a60022ee9a5fae24840840583038da0 100644 (file)
@@ -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 (file)
index 0000000..3724052
--- /dev/null
@@ -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()
index 6374c34783d15affd2b222316403264c5ce36712..9a72a309dabdfa8d2f5c4b1e7834d9bf4eba4616 100644 (file)
@@ -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")
index dd69351d8d417c9b19e2266619f048abab9b4764..c409a0dfab95aeb6874bdc865d3a5a33642da6ac 100644 (file)
@@ -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")