]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Disable zlib-ng internal tests when BUILD_SHARED_LIBS=ON.
authorNathan Moinvaziri <nathan@nathanm.com>
Wed, 8 Feb 2023 08:32:54 +0000 (00:32 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 8 Feb 2023 19:35:58 +0000 (20:35 +0100)
When BUILD_SHARED_LIBS=ON some zlib-ng internal functions are not exported,
which are used by gtest_zlib and benchmark_zlib. Therefore, we must disable
those tests/projects.

CMakeLists.txt

index 27ce9f477c26abe3b8a0d080597ed54bd5fae857..8aad597f98b430064db3d935aaa1ba7f7b1ff913 100644 (file)
@@ -1179,6 +1179,19 @@ option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
 if(ZLIB_ENABLE_TESTS)
     enable_testing()
 
+    if(BUILD_SHARED_LIBS)
+        if(ZLIBNG_ENABLE_TESTS)
+            message(STATUS "Disabling zlib-ng tests because shared libraries are enabled")
+            set(ZLIBNG_ENABLE_TESTS OFF)
+        endif()
+
+        if(WITH_BENCHMARKS OR WITH_BENCHMARK_APPS)
+            message(STATUS "Disabling benchmarks because shared libraries are enabled")
+            set(WITH_BENCHMARKS OFF)
+            set(WITH_BENCHMARK_APPS OFF)
+        endif()
+    endif()
+
     add_subdirectory(test)
 endif()