Merge remote-tracking branch 'origin/topic/jsiwek/gh-475-no-default-tcmalloc'

* origin/topic/jsiwek/gh-475-no-default-tcmalloc:
  GH-475: Require --enable-perftools to link in tcmalloc

I added an error message is --enable-perftools is given, but perftools
is not found - it does not seem great to not abort in these cases.
This commit is contained in:
Johanna Amann 2019-07-22 10:22:45 -07:00
commit d24fb97b53
3 changed files with 13 additions and 22 deletions

View file

@ -199,15 +199,11 @@ set(HAVE_PERFTOOLS false)
set(USE_PERFTOOLS_DEBUG false)
set(USE_PERFTOOLS_TCMALLOC false)
if (NOT DISABLE_PERFTOOLS)
if ( ENABLE_PERFTOOLS )
find_package(GooglePerftools)
endif ()
if (GOOGLEPERFTOOLS_FOUND OR TCMALLOC_FOUND)
set(HAVE_PERFTOOLS true)
# Non-Linux systems may not be well-supported by gperftools, so
# require explicit request from user to enable it in that case.
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ENABLE_PERFTOOLS)
if ( GOOGLEPERFTOOLS_FOUND OR TCMALLOC_FOUND )
set(HAVE_PERFTOOLS true)
set(USE_PERFTOOLS_TCMALLOC true)
if (ENABLE_PERFTOOLS_DEBUG)
@ -216,18 +212,14 @@ if (GOOGLEPERFTOOLS_FOUND OR TCMALLOC_FOUND)
include_directories(BEFORE ${GooglePerftools_INCLUDE_DIR})
list(APPEND OPTLIBS ${GooglePerftools_LIBRARIES_DEBUG})
else ()
# Link in tcmalloc for better performance.
# Link in tcmalloc.
list(APPEND OPTLIBS ${GooglePerftools_LIBRARIES})
endif ()
else()
message(FATAL_ERROR "Could not find requested Google Perftools.")
endif ()
endif ()
if (ENABLE_PERFTOOLS_DEBUG OR ENABLE_PERFTOOLS)
# Just a no op to prevent CMake from complaining about manually-specified
# ENABLE_PERFTOOLS_DEBUG or ENABLE_PERFTOOLS not being used if google
# perftools weren't found
endif ()
# Making sure any non-standard OpenSSL includes get searched earlier
# than other dependencies which tend to be in standard system locations
# and thus cause the system OpenSSL headers to still be picked up even