FindGooglePerfTools.cmake
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:2k
源码类别:

游戏引擎

开发平台:

C++ Builder

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