From 48c45a004a06e5e36bdda31d815f59abc57026de Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja.osipov@gmail.com>
Date: Tue, 28 Feb 2012 13:18:05 +0400
Subject: [PATCH] Do not include VALGRIND and <assert.h> code in
 RelWithDebugInfo builds.

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a15301f1fb..cb3341db9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,7 @@ endif()
 # Perform build type specific configuration.
 #
 set (CMAKE_C_FLAGS_DEBUG "-ggdb -O0 -fexceptions -funwind-tables")
-set (CMAKE_C_FLAGS_RELWITHDEBUGINFO "-ggdb -O2 -fexceptions -funwind-tables")
+set (CMAKE_C_FLAGS_RELWITHDEBUGINFO "-ggdb -O2 -fexceptions -funwind-tables -DNDEBUG -DNVALGRIND")
 set (CMAKE_C_FLAGS_RELEASE "-DNDEBUG -DNVALGRIND")
 
 #
@@ -156,6 +156,9 @@ endif()
 
 if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
     set (core_cflags "${core_cflags} -Werror")
+else()
+# Remove VALGRIND code and assertions in *any* type of release build.
+    set (core_cflags "${core_cflags} -DNDEBUG -DNVALGRIND")
 endif()
 
 #
-- 
GitLab