about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-07-25 10:57:40 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2017-07-25 12:29:49 +0100
commitdf899b02e279ed65dc94f55d4b671560f667497b (patch)
treecabd16a2853e32ceaa9c0ef4d2aeab283f00fe28
parentb496ea27957133f0294aae89b0906660c055382b (diff)
downloadklee-df899b02e279ed65dc94f55d4b671560f667497b.tar.gz
[CMake] Emit warning when mixing assert and non assert builds.
This could lead to lots of problems. If we discover that these
configurations don't work at all we should make this an error.
-rw-r--r--CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9d7e61a..e066b89e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -224,6 +224,21 @@ else()
   unset(ENABLE_KLEE_DEBUG) # for config.h
 endif()
 
+# Warn about mixing build types.
+# This is likely a bad idea because some of LLVM's header files use the NDEBUG
+# macro which can change things like data layout.
+if (LLVM_ENABLE_ASSERTIONS AND (NOT ENABLE_KLEE_ASSERTS))
+  message(WARNING
+    "LLVM was built with assertions but KLEE will be built without them.\n"
+    "This might lead to unexpected behaviour."
+  )
+elseif ((NOT LLVM_ENABLE_ASSERTIONS) AND ENABLE_KLEE_ASSERTS)
+  message(WARNING
+    "LLVM was built without assertions but KLEE will be built with them.\n"
+    "This might lead to unexpected behaviour."
+  )
+endif()
+
 if (LLVM_ENABLE_VISIBILITY_INLINES_HIDDEN)
   list(APPEND KLEE_COMPONENT_CXX_FLAGS "-fvisibility-inlines-hidden")
 endif()