about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
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 /CMakeLists.txt
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.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt22
1 files changed, 17 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()