From 5de8b3a8ee0428265a03b1609c6e4f59ede4b2f7 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 18 Jul 2013 15:10:31 -0700 Subject: [PATCH] Add support for tcmalloc Signed-off-by: Leonardo de Moura --- src/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 26aca9560..c5ee4c695 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,9 +32,18 @@ if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) find_path(GMP_INCLUDE_DIR NAMES gmp.h ) -find_library(GMP_LIBRARIES NAMES gmp libgmp ) +find_library(GMP_LIBRARIES NAMES gmp libgmp REQUIRED) message(STATUS "GMP: " ${GMP_LIBRARIES}) +find_library(TCMALLOC_LIBRARY tcmalloc) +if (${TCMALLOC_LIBRARY} MATCHES "TCMALLOC_LIBRARY-NOTFOUND") + message("*** WARNING: failed to find tcmalloc") + message("*** The (optional) tcmalloc library is available at: https://code.google.com/p/gperftools") +else() + message("Found tcmalloc") + set(EXTRA_LIBS ${EXTRA_LIBS} ${TCMALLOC_LIBRARY}) +endif() + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)