better cmake process for MI_VALGRIND

This commit is contained in:
daan 2022-10-30 14:20:35 -07:00
parent 05a75758dd
commit 74d002b61c
1 changed files with 9 additions and 8 deletions

View File

@ -108,6 +108,9 @@ endif()
if(MI_SECURE)
message(STATUS "Set full secure build (MI_SECURE=ON)")
list(APPEND mi_defines MI_SECURE=4)
#if (MI_VALGRIND)
# message(WARNING "Secure mode is a bit weakened when compiling with Valgrind support as buffer overflow detection is no longer byte-precise (if running without valgrind)")
#endif()
endif()
if(MI_VALGRIND)
@ -265,20 +268,18 @@ else()
set(mi_install_cmakedir "${CMAKE_INSTALL_LIBDIR}/cmake/mimalloc-${mi_version}") # for cmake package info
endif()
set(mi_basename "mimalloc")
if(MI_SECURE)
set(mi_basename "mimalloc-secure")
else()
if(MI_VALGRIND)
set(mi_basename "mimalloc-valgrind")
else()
set(mi_basename "mimalloc")
endif()
set(mi_basename "${mi_basename}-secure")
endif()
if(MI_VALGRIND)
set(mi_basename "${mi_basename}-valgrind")
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC)
if(NOT(CMAKE_BUILD_TYPE_LC MATCHES "^(release|relwithdebinfo|minsizerel|none)$"))
set(mi_basename "${mi_basename}-${CMAKE_BUILD_TYPE_LC}") #append build type (e.g. -debug) if not a release version
endif()
if(MI_BUILD_SHARED)
list(APPEND mi_build_targets "shared")
endif()