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)
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")
| 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 |
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)