From: Cameron Cawley Date: Thu, 13 Oct 2022 17:52:50 +0000 (+0100) Subject: Allow gtest_zlib to be manually disabled X-Git-Tag: 2.1.0-beta1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43fd141840821bd09b96a8ce2b4dec5b5ad563ff;p=thirdparty%2Fzlib-ng.git Allow gtest_zlib to be manually disabled --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 642d35f42..4400fea58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) option(ZLIB_ENABLE_TESTS "Build test binaries" ON) option(ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API" ON) +option(WITH_GTEST "Build gtest_zlib" ON) option(WITH_FUZZERS "Build test/fuzz" OFF) option(WITH_BENCHMARKS "Build test/benchmarks" OFF) option(WITH_BENCHMARK_APPS "Build application benchmarks" OFF) @@ -1187,6 +1188,7 @@ add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Compile with zlib compatible API") add_feature_info(ZLIB_ENABLE_TESTS ZLIB_ENABLE_TESTS "Build test binaries") add_feature_info(ZLIBNG_ENABLE_TESTS ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API") add_feature_info(WITH_SANITIZER WITH_SANITIZER "Enable sanitizer support") +add_feature_info(WITH_GTEST WITH_GTEST "Build gtest_zlib") add_feature_info(WITH_FUZZERS WITH_FUZZERS "Build test/fuzz") add_feature_info(WITH_BENCHMARKS WITH_BENCHMARKS "Build test/benchmarks") add_feature_info(WITH_BENCHMARK_APPS WITH_BENCHMARK_APPS "Build application benchmarks") diff --git a/README.md b/README.md index a1218d44d..80b921b2c 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ Build Options | WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | | WITH_NATIVE_INSTRUCTIONS | --native | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | | WITH_SANITIZER | | Build with sanitizer (memory, address, undefined) | OFF | +| WITH_GTEST | | Build gtest_zlib | ON | | WITH_FUZZERS | | Build test/fuzz | OFF | | WITH_BENCHMARKS | | Build test/benchmarks | OFF | | WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 55a3057be..11cf73175 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -92,16 +92,26 @@ if(WITH_FUZZERS) add_subdirectory(fuzz) endif() -if(CMAKE_VERSION VERSION_LESS 3.12) - message(WARNING "Minimum cmake version of 3.12 not met for GoogleTest or benchmarks!") -else() - enable_language(CXX) +if(WITH_GTEST OR WITH_BENCHMARKS) + if(CMAKE_VERSION VERSION_LESS 3.12) + message(WARNING "Minimum cmake version of 3.12 not met for GoogleTest or benchmarks!") - include(FetchContent) + set(WITH_GTEST OFF) + set(WITH_GTEST OFF PARENT_SCOPE) - if(WITH_BENCHMARKS) - add_subdirectory(benchmarks) + set(WITH_BENCHMARKS OFF) + set(WITH_BENCHMARKS OFF PARENT_SCOPE) + else() + enable_language(CXX) endif() +endif() + +if(WITH_BENCHMARKS) + add_subdirectory(benchmarks) +endif() + +if(WITH_GTEST) + include(FetchContent) # Google test requires at least C++11 set(CMAKE_CXX_STANDARD 11)