PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/cmake/FindGooglePerfTools.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 66 lines | 46 code | 10 blank | 10 comment | 0 complexity | a72b2d0b1f9618d088b20c760778916a MD5 | raw file
 1# -*- cmake -*-
 2
 3# - Find Google perftools
 4# Find the Google perftools includes and libraries
 5# This module defines
 6#  GOOGLE_PERFTOOLS_INCLUDE_DIR, where to find heap-profiler.h, etc.
 7#  GOOGLE_PERFTOOLS_FOUND, If false, do not try to use Google perftools.
 8# also defined for general use are
 9#  TCMALLOC_LIBRARIES, where to find the tcmalloc library.
10#  STACKTRACE_LIBRARIES, where to find the stacktrace library.
11#  PROFILER_LIBRARIES, where to find the profiler library.
12
13FIND_PATH(GOOGLE_PERFTOOLS_INCLUDE_DIR google/heap-profiler.h
14/usr/local/include
15/usr/include
16)
17
18SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc)
19FIND_LIBRARY(TCMALLOC_LIBRARY
20  NAMES ${TCMALLOC_NAMES}
21  PATHS /usr/lib /usr/local/lib
22  )
23
24IF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
25    SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY})
26    SET(GOOGLE_PERFTOOLS_FOUND "YES")
27ELSE (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
28  SET(GOOGLE_PERFTOOLS_FOUND "NO")
29ENDIF (TCMALLOC_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
30
31SET(STACKTRACE_NAMES ${STACKTRACE_NAMES} stacktrace)
32FIND_LIBRARY(STACKTRACE_LIBRARY
33  NAMES ${STACKTRACE_LIBRARY}
34  PATHS /usr/lib /usr/local/lib
35  )
36
37IF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
38    SET(STACKTRACE_LIBRARIES ${STACKTRACE_LIBRARY})
39ENDIF (STACKTRACE_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
40
41SET(PROFILER_NAMES ${PROFILER_NAMES} profiler)
42FIND_LIBRARY(PROFILER_LIBRARY
43  NAMES ${PROFILER_LIBRARY}
44  PATHS /usr/lib /usr/local/lib
45  )
46
47IF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
48    SET(PROFILER_LIBRARIES ${PROFILER_LIBRARY})
49ENDIF (PROFILER_LIBRARY AND GOOGLE_PERFTOOLS_INCLUDE_DIR)
50
51IF (GOOGLE_PERFTOOLS_FOUND)
52   IF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
53      MESSAGE(STATUS "Found Google perftools: ${GOOGLE_PERFTOOLS_LIBRARIES}")
54   ENDIF (NOT GOOGLE_PERFTOOLS_FIND_QUIETLY)
55ELSE (GOOGLE_PERFTOOLS_FOUND)
56   IF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
57      MESSAGE(FATAL_ERROR "Could not find Google perftools library")
58   ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
59ENDIF (GOOGLE_PERFTOOLS_FOUND)
60
61MARK_AS_ADVANCED(
62  TCMALLOC_LIBRARY
63  STACKTRACE_LIBRARY
64  PROFILER_LIBRARY
65  GOOGLE_PERFTOOLS_INCLUDE_DIR
66  )