]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build: Use FetchContent_MakeAvailable instead of FetchContent_Populate
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 14 Jul 2025 13:44:22 +0000 (15:44 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 14 Jul 2025 13:57:57 +0000 (15:57 +0200)
Closes #1501.

cmake/FindHiredis.cmake
cmake/FindXxhash.cmake
cmake/FindZstd.cmake

index cfd884408ef5f938c9a9d09920aed0a89fb80d98..559b98c35d8bf22558fb295aecd315cdd99aa198 100644 (file)
@@ -41,11 +41,13 @@ if(_download_hiredis)
     Hiredis
     URL "https://github.com/redis/hiredis/archive/refs/tags/v${_hiredis_version_string}.tar.gz"
     URL_HASH SHA256=25cee4500f359cf5cad3b51ed62059aadfc0939b05150c1f19c7e2829123631c
+    # Intentionally not using hiredis's build system since it doesn't put
+    # headers in a hiredis subdirectory. Reference:
+    # https://discourse.cmake.org/t/prevent-fetchcontent-makeavailable-to-execute-cmakelists-txt/12704/3
+    SOURCE_SUBDIR dummy
   )
+  FetchContent_MakeAvailable(Hiredis)
 
-  # Intentionally not using hiredis's build system since it doesn't put headers
-  # in a hiredis subdirectory.
-  FetchContent_Populate(Hiredis)
   set(
     _hiredis_sources
     "${hiredis_SOURCE_DIR}/alloc.c"
index f12355fae3c5f5661fe0ea44e51ceaa2a42ed038..b1a1cdd3deeef66a2bd91596aeb6ac578db3d2e7 100644 (file)
@@ -42,8 +42,8 @@ if(_download_xxhash)
     URL "https://github.com/Cyan4973/xxhash/archive/refs/tags/v${_xxhash_version_string}.tar.gz"
     URL_HASH SHA256=aae608dfe8213dfd05d909a57718ef82f30722c392344583d3f39050c7f29a80
   )
+  FetchContent_MakeAvailable(Xxhash)
 
-  FetchContent_Populate(Xxhash)
   set(_xxhash_sources "${xxhash_SOURCE_DIR}/xxhash.c")
   if(PLATFORM STREQUAL x86_64 OR PLATFORM STREQUAL AMD64)
     list(APPEND _xxhash_sources "${xxhash_SOURCE_DIR}/xxh_x86dispatch.c")
index b5c758e5effbdb9dabd03aa159a678432eec06ac..b81d408a4f5ced09a18442a963223f53b65fc35b 100644 (file)
@@ -48,13 +48,7 @@ if(_download_zstd)
     SOURCE_SUBDIR build/cmake
     ${_zstd_patch}
   )
-
-  # When it works: Use FetchContent_MakeAvailable(Zstd) instead
-  FetchContent_GetProperties(zstd)
-  if(NOT zstd_POPULATED)
-    FetchContent_Populate(Zstd)
-    add_subdirectory("${zstd_SOURCE_DIR}/build/cmake" "${zstd_BINARY_DIR}" EXCLUDE_FROM_ALL)
-  endif()
+  FetchContent_MakeAvailable(Zstd)
 
   unset(ZSTD_BUILD_PROGRAMS)
   unset(ZSTD_BUILD_SHARED)