From fc3ecad5d50b59945ffd3f44c78472c3ecc70b87 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 1 Apr 2016 09:40:02 -0300 Subject: [PATCH] Add ZLIB_TESTS command line option to disable tests if needed --- CMakeLists.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fe939df6..3f33e84d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(VERSION "1.2.11") option(ASM686 "Enable building i686 assembly implementation") option(AMD64 "Enable building amd64 assembly implementation") +option(ZLIB_TESTS "Build zlib tests" ON) set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -230,20 +231,22 @@ endif() # Example binaries #============================================================================ -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) +if(ZLIB_TESTS) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) + 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) + 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) - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -endif() + 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() \ No newline at end of file