From: Joel Rosdahl Date: Mon, 14 Jul 2025 13:44:22 +0000 (+0200) Subject: build: Use FetchContent_MakeAvailable instead of FetchContent_Populate X-Git-Tag: v4.12~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8648532e3cdcd6a0c4fb12b65e1ca9a8972a1e06;p=thirdparty%2Fccache.git build: Use FetchContent_MakeAvailable instead of FetchContent_Populate Closes #1501. --- diff --git a/cmake/FindHiredis.cmake b/cmake/FindHiredis.cmake index cfd88440..559b98c3 100644 --- a/cmake/FindHiredis.cmake +++ b/cmake/FindHiredis.cmake @@ -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" diff --git a/cmake/FindXxhash.cmake b/cmake/FindXxhash.cmake index f12355fa..b1a1cdd3 100644 --- a/cmake/FindXxhash.cmake +++ b/cmake/FindXxhash.cmake @@ -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") diff --git a/cmake/FindZstd.cmake b/cmake/FindZstd.cmake index b5c758e5..b81d408a 100644 --- a/cmake/FindZstd.cmake +++ b/cmake/FindZstd.cmake @@ -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)