You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CMakeLists.txt
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ option(MI_GUARDED "Build with guard pages behind certain object alloca
13
13
option(MI_USE_CXX"Use the C++ compiler to compile the library (instead of the C compiler)"OFF)
14
14
option(MI_OPT_ARCH"Only for optimized builds: turn on architecture specific optimizations (for x64: '-march=haswell;-mavx2' (2013), for arm64: '-march=armv8.1-a' (2016))"OFF)
15
15
option(MI_OPT_SIMD"Use SIMD instructions (requires MI_OPT_ARCH to be enabled)"OFF)
16
+
option(MI_FREE_IS_CHECKED"Always check for invalid pointers in 'free' (always enabled in debug and secure builds, or when MI_OVERRIDE is ON)"OFF)
16
17
17
18
option(MI_DEBUG"Enable assertion checks (enabled by default in a debug build)"OFF)
18
19
option(MI_DEBUG_INTERNAL"Enable assertion and internal invariant checks (enabled by default in a debug build)"OFF)
@@ -378,6 +379,17 @@ else()
378
379
endif()
379
380
endif()
380
381
382
+
if(MI_DEBUG OR MI_SECURE)
383
+
set(MI_FREE_IS_CHECKED ON)
384
+
endif()
385
+
if(MI_FREE_IS_CHECKED)
386
+
message(STATUS"Check validity of pointers passed to 'mi_free' (MI_FREE_IS_CHECKED=ON)")
387
+
list(APPEND mi_defines MI_FREE_IS_CHECKED=1)
388
+
elseif(MI_OVERRIDE)
389
+
message(STATUS"Check validity of pointers passed to 'mi_free' only in the dynamic link library (MI_OVERRIDE=ON, MI_FREE_IS_CHECKED=OFF)")
0 commit comments