diff options
Diffstat (limited to 'cmake/jemalloc.cmake')
-rw-r--r-- | cmake/jemalloc.cmake | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake index 54e69da5a28..5cb9c493a20 100644 --- a/cmake/jemalloc.cmake +++ b/cmake/jemalloc.cmake @@ -30,14 +30,23 @@ MACRO (USE_BUNDLED_JEMALLOC) ENDMACRO() SET(WITH_JEMALLOC "yes" CACHE STRING - "Which jemalloc to use (possible values are 'no', 'bundled', 'yes' (same as bundled)") -#"Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") + "Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") MACRO (CHECK_JEMALLOC) IF(WIN32) SET(WITH_JEMALLOC "no") ENDIF() - IF(WITH_JEMALLOC STREQUAL "bundled" OR WITH_JEMALLOC STREQUAL "yes") + IF(WITH_JEMALLOC STREQUAL "system" OR WITH_JEMALLOC STREQUAL "yes") + CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC) + IF (HAVE_JEMALLOC) + SET(LIBJEMALLOC jemalloc) + ELSEIF (WITH_JEMALLOC STREQUAL "system") + MESSAGE(FATAL_ERROR "system jemalloc is not found") + ELSEIF (WITH_JEMALLOC STREQUAL "yes") + SET(trybundled 1) + ENDIF() + ENDIF() + IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled) USE_BUNDLED_JEMALLOC() ENDIF() ENDMACRO() |