]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Pin Google Benchmark to v1.7.0 since master tag has been removed.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 11 Sep 2022 19:35:24 +0000 (15:35 -0400)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 26 Sep 2022 18:09:36 +0000 (20:09 +0200)
test/benchmarks/CMakeLists.txt

index bfd4b081afacf22cbef3e9507063664463a888f0..cfcb360b5cc0becf51fb2c48ff322aa31b2304c7 100644 (file)
@@ -12,13 +12,23 @@ find_package(benchmark QUIET)
 if(NOT benchmark_FOUND)
     # Fetch google benchmark source code from official repository
     set(BENCHMARK_ENABLE_TESTING OFF)
+
+    # Allow specifying alternative Google benchmark repository
+    if(NOT DEFINED GBENCHMARK_REPOSITORY)
+        set(GBENCHMARK_REPOSITORY https://github.com/google/benchmark.git)
+    endif()
+    if(NOT DEFINED GBENCHMARK_TAG)
+        set(GBENCHMARK_TAG v1.7.0)
+    endif()
+
     FetchContent_Declare(benchmark
-        GIT_REPOSITORY https://github.com/google/benchmark.git)
+        GIT_REPOSITORY ${GBENCHMARK_REPOSITORY}
+        GIT_TAG ${GBENCHMARK_TAG})
 
     FetchContent_GetProperties(benchmark)
     if(NOT benchmark_POPULATED)
         FetchContent_Populate(benchmark)
-        add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR})
+        add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR} EXCLUDE_FROM_ALL)
     endif()
 endif()
 
@@ -31,6 +41,7 @@ add_executable(benchmark_zlib
     benchmark_slidehash.cc
     )
 
+target_compile_definitions(benchmark_zlib PRIVATE -DBENCHMARK_STATIC_DEFINE)
 target_include_directories(benchmark_zlib PRIVATE
     ${PROJECT_SOURCE_DIR}
     ${PROJECT_BINARY_DIR}