diff --git a/CMakeLists.txt b/CMakeLists.txt index 28f7eb894..91647d83b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -511,7 +511,11 @@ if(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP) endif() include(CheckCXXSymbolExists) -check_cxx_symbol_exists(malloc_usable_size malloc.h HAVE_MALLOC_USABLE_SIZE) +if(CMAKE_SYSTEM_NAME MATCHES "^FreeBSD") + check_cxx_symbol_exists(malloc_usable_size malloc_np.h HAVE_MALLOC_USABLE_SIZE) +else() + check_cxx_symbol_exists(malloc_usable_size malloc.h HAVE_MALLOC_USABLE_SIZE) +endif() if(HAVE_MALLOC_USABLE_SIZE) add_definitions(-DROCKSDB_MALLOC_USABLE_SIZE) endif()