Skip to content

Commit c7bce0b

Browse files
committed
Fix CXXFLAGS when coverage enabled.
1 parent e4a31e0 commit c7bce0b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ include(CMakeDependentOption)
4747
include(CMakePackageConfigHelpers)
4848
include(FeatureSummary)
4949

50+
# We need to enable C++ before trying to check for coverage
51+
option(WITH_GTEST "Build gtest_zlib" ON)
52+
option(WITH_FUZZERS "Build test/fuzz" OFF)
53+
option(WITH_BENCHMARKS "Build test/benchmarks" OFF)
54+
55+
if(WITH_GTEST OR WITH_BENCHMARKS OR WITH_FUZZERS)
56+
enable_language(CXX)
57+
endif()
58+
5059
include(cmake/detect-arch.cmake)
5160
include(cmake/detect-install-dirs.cmake)
5261
include(cmake/detect-coverage.cmake)
@@ -79,9 +88,6 @@ option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON)
7988
option(ZLIB_COMPAT "Compile with zlib compatible API" OFF)
8089
option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
8190
option(ZLIBNG_ENABLE_TESTS "Test zlib-ng specific API" ON)
82-
option(WITH_GTEST "Build gtest_zlib" ON)
83-
option(WITH_FUZZERS "Build test/fuzz" OFF)
84-
option(WITH_BENCHMARKS "Build test/benchmarks" OFF)
8591
option(WITH_BENCHMARK_APPS "Build application benchmarks" OFF)
8692
option(WITH_OPTIM "Build with optimisation" ON)
8793
option(WITH_REDUCED_MEM "Reduced memory usage for special cases (reduces performance)" OFF)

0 commit comments

Comments
 (0)