about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--cmake/find_llvm.cmake13
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)