mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-03 14:09:31 +03:00
bump cmake required version to 3.18 and detect libatomic more reliably, see pr #898
This commit is contained in:
parent
7ea7296d3e
commit
03224e17a0
2 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
project(libmimalloc C CXX)
|
project(libmimalloc C CXX)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
@ -35,6 +35,7 @@ option(MI_NO_THP "Disable transparent huge pages support on Linux/And
|
||||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
||||||
option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems) (deprecated and detected automatically)" OFF)
|
option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems) (deprecated and detected automatically)" OFF)
|
||||||
|
|
||||||
|
include(CheckLinkerFlag) # requires cmake 3.18
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include("cmake/mimalloc-config-version.cmake")
|
include("cmake/mimalloc-config-version.cmake")
|
||||||
|
@ -354,12 +355,9 @@ else()
|
||||||
list(APPEND mi_libraries ${MI_LIBRT})
|
list(APPEND mi_libraries ${MI_LIBRT})
|
||||||
set(pc_libraries "${pc_libraries} -lrt")
|
set(pc_libraries "${pc_libraries} -lrt")
|
||||||
endif()
|
endif()
|
||||||
find_library(MI_LIBATOMIC atomic)
|
check_linker_flag(C "-latomic" MI_HAS_LIBATOMIC) # do not use `find_library` as libatomic is not always in the system path (issue #898)
|
||||||
if (NOT MI_LIBATOMIC AND MI_USE_LIBATOMIC)
|
if (MI_HAS_LIBATOMIC OR MI_USE_LIBATOMIC)
|
||||||
set(MI_LIBATOMIC atomic)
|
list(APPEND mi_libraries "atomic")
|
||||||
endif()
|
|
||||||
if (MI_LIBATOMIC)
|
|
||||||
list(APPEND mi_libraries ${MI_LIBATOMIC})
|
|
||||||
set(pc_libraries "${pc_libraries} -latomic")
|
set(pc_libraries "${pc_libraries} -latomic")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -24,7 +24,7 @@ not accidentally mix pointers from different allocators).
|
||||||
#define free(p) mi_free(p)
|
#define free(p) mi_free(p)
|
||||||
|
|
||||||
#define strdup(s) mi_strdup(s)
|
#define strdup(s) mi_strdup(s)
|
||||||
#define strndup(s,n) mi_strndup(s,n)
|
#define strndup(s,n) mi_strndup(s,n)
|
||||||
#define realpath(f,n) mi_realpath(f,n)
|
#define realpath(f,n) mi_realpath(f,n)
|
||||||
|
|
||||||
// Microsoft extensions
|
// Microsoft extensions
|
||||||
|
|
Loading…
Add table
Reference in a new issue