diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2017-07-25 10:45:07 +0100 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2017-07-25 10:45:07 +0100 |
commit | b496ea27957133f0294aae89b0906660c055382b (patch) | |
tree | dcbfe1f26f722abdc5e763a50d9dbd9d516af22c | |
parent | c06cc05adc7eac45ff16d7e488576d479811d7a8 (diff) | |
download | klee-b496ea27957133f0294aae89b0906660c055382b.tar.gz |
[CMake] Fix bug where we would inherit LLVM's `-DNDEBUG` define
when LLVM was built without assertions. This prevented `ENABLE_KLEE_ASSERTS` from working correctly. Reported by @MartinNowack .
-rw-r--r-- | cmake/find_llvm.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake index 770fca84..49ca51d4 100644 --- a/cmake/find_llvm.cmake +++ b/cmake/find_llvm.cmake @@ -227,3 +227,16 @@ else() set(${OUTPUT_VAR} ${targets_to_return} PARENT_SCOPE) endfunction() endif() + +# Filter out `-DNEBUG` from LLVM_DEFINITIONS. The caller can use +# `LLVM_ENABLE_ASSERTIONS` to decide how to set their defines. +set(_new_llvm_definitions "") +foreach (llvm_define ${LLVM_DEFINITIONS}) + if ("${llvm_define}" STREQUAL "-DNDEBUG") + # Skip + else() + list(APPEND _new_llvm_definitions "${llvm_define}") + endif() +endforeach() +set(LLVM_DEFINITIONS "${_new_llvm_definitions}") +unset(_new_llvm_definitions) |