FindGperftools.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Tries to find Gperftools.
  16. #
  17. # Usage of this module as follows:
  18. #
  19. # find_package(Gperftools)
  20. #
  21. # Variables used by this module, they can change the default behaviour and need
  22. # to be set before calling find_package:
  23. #
  24. # Gperftools_ROOT_DIR Set this variable to the root installation of
  25. # Gperftools if the module has problems finding
  26. # the proper installation path.
  27. #
  28. # Variables defined by this module:
  29. #
  30. # GPERFTOOLS_FOUND System has Gperftools libs/headers
  31. # GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
  32. # GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
  33. find_library(GPERFTOOLS_TCMALLOC
  34. NAMES tcmalloc
  35. HINTS ${Gperftools_ROOT_DIR}/lib)
  36. find_library(GPERFTOOLS_PROFILER
  37. NAMES profiler
  38. HINTS ${Gperftools_ROOT_DIR}/lib)
  39. find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
  40. NAMES tcmalloc_and_profiler
  41. HINTS ${Gperftools_ROOT_DIR}/lib)
  42. find_path(GPERFTOOLS_INCLUDE_DIR
  43. NAMES gperftools/heap-profiler.h
  44. HINTS ${Gperftools_ROOT_DIR}/include)
  45. set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
  46. include(FindPackageHandleStandardArgs)
  47. find_package_handle_standard_args(
  48. Gperftools
  49. DEFAULT_MSG
  50. GPERFTOOLS_LIBRARIES
  51. GPERFTOOLS_INCLUDE_DIR)
  52. mark_as_advanced(
  53. Gperftools_ROOT_DIR
  54. GPERFTOOLS_TCMALLOC
  55. GPERFTOOLS_PROFILER
  56. GPERFTOOLS_TCMALLOC_AND_PROFILER
  57. GPERFTOOLS_LIBRARIES
  58. GPERFTOOLS_INCLUDE_DIR)