]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed content already populated error in CMake scripts. #1327
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 21 Aug 2022 17:03:32 +0000 (10:03 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 5 Sep 2022 09:24:50 +0000 (11:24 +0200)
Should only need to use either FetchContent_MakeAvailable or
FetchContent_GetProperties and FetchContent_Populate but not both methods. We
use the later for CMake compatibility with lower versions.

test/benchmarks/CMakeLists.txt
test/pigz/CMakeLists.txt

index 19762fc738abe506d2a396c088277567e2000c68..e6eaa352b0a182614bd27959337ee7574c70da68 100644 (file)
@@ -14,11 +14,11 @@ if(NOT benchmark_FOUND)
     set(BENCHMARK_ENABLE_TESTING OFF)
     FetchContent_Declare(benchmark
         GIT_REPOSITORY https://github.com/google/benchmark.git)
-    FetchContent_MakeAvailable(benchmark)
-    FetchContent_GetProperties(benchmark)
 
+    FetchContent_GetProperties(benchmark)
     if(NOT benchmark_POPULATED)
         FetchContent_Populate(benchmark)
+        add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR})
     endif()
 endif()
 
@@ -55,15 +55,15 @@ if(WITH_BENCHMARK_APPS)
     if(NOT PNG_FOUND)
         FetchContent_Declare(PNG
             GIT_REPOSITORY https://github.com/glennrp/libpng.git)
-        FetchContent_MakeAvailable(PNG)
-        FetchContent_GetProperties(PNG)
 
+        FetchContent_GetProperties(PNG)
         if(NOT PNG_POPULATED)
             FetchContent_Populate(PNG)
+            add_subdirectory(${PNG_SOURCE_DIR} ${PNG_BINARY_DIR})
         endif()
     endif()
 
-    set(BENCH_APP_SRCS 
+    set(BENCH_APP_SRCS
         benchmark_png_encode.cc
         benchmark_png_decode.cc
         benchmark_main.cc
index d1f5b22d23f8478d184b2d428e75aba58db491c1..bc6830ae241c9b3ca5b32ecfe527981e17585ccc 100644 (file)
@@ -64,9 +64,8 @@ endif()
 FetchContent_Declare(pigz
     GIT_REPOSITORY https://github.com/madler/pigz.git
     GIT_TAG ${PIGZ_TAG})
-FetchContent_MakeAvailable(pigz)
-FetchContent_GetProperties(pigz)
 
+FetchContent_GetProperties(pigz)
 if(NOT pigz_POPULATED)
     FetchContent_Populate(pigz)
 endif()