From ad01456b3a00d1b91a13eb6f8032ee15ea3d6abf Mon Sep 17 00:00:00 2001
From: Christof Kraus <christof.j.kraus@gmail.com>
Date: Sat, 16 Jan 2021 20:27:26 +0100
Subject: [PATCH] don't use GLIBCXX_ASSERTIONS in production

---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c53cdbe6..dce5cb1b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,7 +101,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
 
     # Enables extra error checking in the form of precondition assertion, such
     # as bounds checking and null pointer checks when dereferencing smart pointers
-    add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)
+    string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+    if (uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELWITHDEBINFO)$")
+        add_compile_options(-Wp,-D_GLIBCXX_ASSERTIONS)
+    endif()
 else ()
     message (STATUS "Unknown C++ compiler. Please use the GNU or Intel compiler, if you are having problems.")
 endif ()
-- 
GitLab