]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add option to disable test binaries ZLIB_ENABLE_TESTS
authorproller <proller@github.com>
Wed, 22 Nov 2017 12:41:50 +0000 (15:41 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 16 Feb 2018 10:45:51 +0000 (11:45 +0100)
CMakeLists.txt

index de96bb56812779cedf0bcd6ccbaabb7c414dd50b..41faf57454530d3641bbfb21c6889a56a17a8633 100644 (file)
@@ -31,8 +31,6 @@ else()
     add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)")
 endif()
 
-enable_testing()
-
 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
 check_include_file(stdint.h    HAVE_STDINT_H)
 check_include_file(stddef.h    HAVE_STDDEF_H)
@@ -642,22 +640,26 @@ endif()
 # Example binaries
 #============================================================================
 
-add_executable(example test/example.c)
-target_link_libraries(example zlib)
-add_test(example example${CMAKE_EXECUTABLE_SUFFIX})
-
-add_executable(minigzip test/minigzip.c)
-target_link_libraries(minigzip zlib)
-
-if(HAVE_OFF64_T)
-    add_executable(example64 test/example.c)
-    target_link_libraries(example64 zlib)
-    set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
-    add_test(example64 example64${CMAKE_EXECUTABLE_SUFFIX})
-
-    add_executable(minigzip64 test/minigzip.c)
-    target_link_libraries(minigzip64 zlib)
-    set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
+option(ZLIB_ENABLE_TESTS "Build test binaries" ON)
+if (ZLIB_ENABLE_TESTS)
+    enable_testing()
+    add_executable(example test/example.c)
+    target_link_libraries(example zlib)
+    add_test(example example${CMAKE_EXECUTABLE_SUFFIX})
+
+    add_executable(minigzip test/minigzip.c)
+    target_link_libraries(minigzip zlib)
+
+    if(HAVE_OFF64_T)
+        add_executable(example64 test/example.c)
+        target_link_libraries(example64 zlib)
+        set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
+        add_test(example64 example64${CMAKE_EXECUTABLE_SUFFIX})
+
+        add_executable(minigzip64 test/minigzip.c)
+        target_link_libraries(minigzip64 zlib)
+        set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
+    endif()
 endif()
 
 FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES)