From 8fe7668af7cbd28e1342275430322ebf2ea06675 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 25 Jul 2017 15:16:09 +0100 Subject: [CMake] Add `ENABLE_ZLIB` option to control whether KLEE uses zlib. The default is `ON` if zlib is found on first configure and `OFF` if zlib is not found on first configure. --- CMakeLists.txt | 22 +++++++++++++++++----- README-CMake.md | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edd533c3..0b7b2869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,12 +362,24 @@ endif() # Support for compressed logs ################################################################################ find_package(ZLIB) -if (${ZLIB_FOUND}) - set(HAVE_ZLIB_H 1) # For config.h - set(TARGET_LIBS ${TARGET_LIBS} z) - list(APPEND KLEE_COMPONENT_EXTRA_LIBRARIES ${ZLIB_LIBRARIES}) - list(APPEND KLEE_COMPONENT_EXTRA_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) +if (ZLIB_FOUND) + set(ENABLE_ZLIB_DEFAULT ON) else() + set(ENABLE_ZLIB_DEFAULT OFF) +endif() +option(ENABLE_ZLIB "Enable use of zlib" ${ENABLE_ZLIB_DEFAULT}) +if (ENABLE_ZLIB) + message(STATUS "Zlib support enabled") + if (ZLIB_FOUND) + set(HAVE_ZLIB_H 1) # For config.h + set(TARGET_LIBS ${TARGET_LIBS} z) + list(APPEND KLEE_COMPONENT_EXTRA_LIBRARIES ${ZLIB_LIBRARIES}) + list(APPEND KLEE_COMPONENT_EXTRA_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "ENABLE_ZLIB is true but zlib could not be found") + endif() +else() + message(STATUS "Zlib support disabled") unset(HAVE_ZLIB_H) # For config.h endif() diff --git a/README-CMake.md b/README-CMake.md index 2d438546..daa1e90c 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -55,6 +55,8 @@ cmake -DCMAKE_BUILD_TYPE=Release /path/to/klee/src * `ENABLE_UNIT_TESTS` (BOOLEAN) - Enable KLEE unit tests. +* `ENABLE_ZLIB` (BOOLEAN) - Enable zlib support. + * `GTEST_SRC_DIR` (STRING) - Path to GTest source tree. * `KLEE_ENABLE_TIMESTAMP` (BOOLEAN) - Enable timestamps in KLEE sources. -- cgit 1.4.1