about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-07-25 15:16:09 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2017-07-28 08:19:52 +0100
commit8fe7668af7cbd28e1342275430322ebf2ea06675 (patch)
tree41a2b7f86f32244cda71d0769fd7ab0a35b0ef7b
parent5080f35f1a12f6872d281e0a823ad9e5046b6a4a (diff)
downloadklee-8fe7668af7cbd28e1342275430322ebf2ea06675.tar.gz
[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.
-rw-r--r--CMakeLists.txt22
-rw-r--r--README-CMake.md2
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.