Skip to content

Commit 660d749

Browse files
committed
do not default to MI_DEBUG=2 in release mode builds even when NDEBUG is not defined by defininig MI_BUILD_RELEASE (issue #1037)
1 parent 7eafaa9 commit 660d749

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,9 @@ if(MI_TRACK_ASAN)
532532
endif()
533533
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC)
534534
list(APPEND mi_defines "MI_CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE_LC}") #todo: multi-config project needs $<CONFIG> ?
535-
if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$"))
535+
if(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$")
536+
list(APPEND mi_defines MI_BUILD_RELEASE)
537+
else()
536538
set(mi_libname "${mi_libname}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version
537539
endif()
538540

include/mimalloc/types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ terms of the MIT license. A copy of the license can be found in the file
6666
// #define MI_DEBUG 2 // + internal assertion checks
6767
// #define MI_DEBUG 3 // + extensive internal invariant checking (cmake -DMI_DEBUG_FULL=ON)
6868
#if !defined(MI_DEBUG)
69-
#if !defined(NDEBUG) || defined(_DEBUG)
70-
#define MI_DEBUG 2
71-
#else
69+
#if defined(MI_BUILD_RELEASE) || defined(NDEBUG)
7270
#define MI_DEBUG 0
71+
#else
72+
#define MI_DEBUG 2
7373
#endif
7474
#endif
7575

0 commit comments

Comments
 (0)