]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix CXXFLAGS when coverage enabled.
authorMika T. Lindqvist <postmaster@raasu.org>
Fri, 11 Apr 2025 17:02:27 +0000 (20:02 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 14 Apr 2025 10:15:59 +0000 (12:15 +0200)
CMakeLists.txt

index f6e2b32a5763d264f7098b1813dc8edb188c703b..bcf0e4919464ea8b2d91775138c360fc1ed53ba6 100644 (file)
@@ -47,6 +47,15 @@ include(CMakeDependentOption)
 include(CMakePackageConfigHelpers)
 include(FeatureSummary)
 
+# We need to enable C++ before trying to check for coverage
+option(WITH_GTEST "Build gtest_zlib" ON)
+option(WITH_FUZZERS "Build test/fuzz" OFF)
+option(WITH_BENCHMARKS "Build test/benchmarks" OFF)
+
+if(WITH_GTEST OR WITH_FUZZERS OR WITH_BENCHMARKS)
+  enable_language(CXX)
+endif()
+
 include(cmake/detect-arch.cmake)
 include(cmake/detect-install-dirs.cmake)
 include(cmake/detect-coverage.cmake)
@@ -79,9 +88,6 @@ 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)
 option(WITH_OPTIM "Build with optimisation" ON)
 option(WITH_REDUCED_MEM "Reduced memory usage for special cases (reduces performance)" OFF)