From: proller Date: Wed, 22 Nov 2017 12:41:50 +0000 (+0300) Subject: Add option to disable test binaries ZLIB_ENABLE_TESTS X-Git-Tag: 1.9.9-b1~646 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0730d030a9ce5c53faa88bd8259c9afccce6881;p=thirdparty%2Fzlib-ng.git Add option to disable test binaries ZLIB_ENABLE_TESTS --- diff --git a/CMakeLists.txt b/CMakeLists.txt index de96bb568..41faf5745 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)