]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
ci: Declare downloaded zstd as EXCLUDE_FROM_ALL master
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Aug 2025 16:04:29 +0000 (18:04 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 3 Aug 2025 16:08:47 +0000 (18:08 +0200)
8648532e3cdcd6a0c4fb12b65e1ca9a8972a1e06 removed usage of
FetchContent_Populate to avoid warnings from newer CMake versions, but
the EXCLUDE_FROM_ALL part got lost in translation.

Corresponding semantics is available by passing EXCLUDE_FROM_ALL to
FetchContent_Declare, but only since CMake 3.28 so we need to add some
backward compatibility goo.

cmake/FindZstd.cmake

index e60ea0f763069959432d5f6174b9f06aecd46fcb..e3fc4eb27d50f320e675219492092a5e69c30621 100644 (file)
@@ -46,10 +46,20 @@ if(_download_zstd)
     URL "https://github.com/facebook/zstd/releases/download/v${_zstd_version_string}/zstd-${_zstd_version_string}.tar.gz"
     URL_HASH SHA256=eb33e51f49a15e023950cd7825ca74a4a2b43db8354825ac24fc1b7ee09e6fa3
     SOURCE_SUBDIR build/cmake
+    EXCLUDE_FROM_ALL # CMake 3.28+
   )
+
   set(_saved_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
   set(BUILD_SHARED_LIBS OFF) # avoid warning from zstd's CMake scripts.
-  FetchContent_MakeAvailable(Zstd)
+  if(CMAKE_VERSION VERSION_LESS "3.28")
+    FetchContent_GetProperties(zstd)
+    if(NOT zstd_POPULATED)
+      FetchContent_Populate(Zstd)
+      add_subdirectory("${zstd_SOURCE_DIR}/build/cmake" "${zstd_BINARY_DIR}" EXCLUDE_FROM_ALL)
+    endif()
+  else()
+    FetchContent_MakeAvailable(Zstd)
+  endif()
   set(BUILD_SHARED_LIBS ${_saved_BUILD_SHARED_LIBS})
   unset(_saved_BUILD_SHARED_LIBS)