summaryrefslogtreecommitdiff
path: root/indra/cmake/FindGooglePerfTools.cmake
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@lindenlab.com>2008-06-02 21:14:31 +0000
committerBryan O'Sullivan <bos@lindenlab.com>2008-06-02 21:14:31 +0000
commit9db949eec327df4173fde3de934a87bedb0db13c (patch)
treeaeffa0f0e68b1d2ceb74d460cbbd22652c9cd159 /indra/cmake/FindGooglePerfTools.cmake
parent419e13d0acaabf5e1e02e9b64a07648bce822b2f (diff)
svn merge -r88066:88786 svn+ssh://svn.lindenlab.com/svn/linden/branches/cmake-9-merge
dataserver-is-deprecated for-fucks-sake-whats-with-these-commit-markers
Diffstat (limited to 'indra/cmake/FindGooglePerfTools.cmake')
-rw-r--r--indra/cmake/FindGooglePerfTools.cmake66
1 files changed, 66 insertions, 0 deletions
diff --git a/indra/cmake/FindGooglePerfTools.cmake b/indra/cmake/FindGooglePerfTools.cmake
new file mode 100644
index 0000000000..bb125d538e
--- /dev/null
+++ b/indra/cmake/FindGooglePerfTools.cmake
@@ -0,0 +1,66 @@
+# -*- cmake -*-
+
+# - Find Google perftools
+# Find the Google perftools includes and libraries
+# This module defines
+# GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc.
+# GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools.
+# also defined for general use are
+# TCMALLOC_LIBRARIES, where to find the tcmalloc library.
+# STACKTRACE_LIBRARIES, where to find the stacktrace library.
+# PROFILER_LIBRARIES, where to find the profiler library.
+
+FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h
+/usr/local/include
+/usr/include
+)
+
+SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc)
+FIND_LIBRARY(TCMALLOC_LIBRARY
+ NAMES ${TCMALLOC_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY})
+ SET(GOOGLE_PERFTOOLS_FOUND "YES")
+ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(GOOGLE_PERFTOOLS_FOUND "NO")
+ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace)
+FIND_LIBRARY(STACKTRACE_LIBRARY
+ NAMES ${STACKTRACE_LIBRARY}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY})
+ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+SET(PROFILER_NAMES ${PROFILER_NAMES} profiler)
+FIND_LIBRARY(PROFILER_LIBRARY
+ NAMES ${PROFILER_LIBRARY}
+ PATHS /usr/lib /usr/local/lib
+ )
+
+IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+ SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY})
+ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
+
+IF (GOOGLE_PERFTOOLS_FOUND)
+ IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}")
+ ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
+ELSE (GOOGLE_PERFTOOLS_FOUND)
+ IF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find Google perftools library")
+ ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
+ENDIF (GOOGLE_PERFTOOLS_FOUND)
+
+MARK_AS_ADVANCED(
+ TCMALLOC_LIBRARY
+ STACKTRACE_LIBRARY
+ PROFILER_LIBRARY
+ GOOGLE_PERFTOOLS_INCLUDE_DIR
+ )