FindJeMalloc.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # - Find JeMalloc library
  2. # Find the native JeMalloc includes and library
  3. # This module defines
  4. # JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when
  5. # JEMALLOC_INCLUDE_DIR is found.
  6. # JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc.
  7. # JEMALLOC_ROOT_DIR, The base directory to search for JeMalloc.
  8. # This can also be an environment variable.
  9. # JEMALLOC_FOUND, If false, do not try to use JeMalloc.
  10. #
  11. # also defined, but not for general use are
  12. # JEMALLOC_LIBRARY, where to find the JeMalloc library.
  13. #=============================================================================
  14. # Copyright 2011 Blender Foundation.
  15. #
  16. # Distributed under the OSI-approved BSD License (the "License");
  17. # see accompanying file Copyright.txt for details.
  18. #
  19. # This software is distributed WITHOUT ANY WARRANTY; without even the
  20. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  21. # See the License for more information.
  22. #=============================================================================
  23. # If JEMALLOC_ROOT_DIR was defined in the environment, use it.
  24. IF(NOT JEMALLOC_ROOT_DIR AND NOT $ENV{JEMALLOC_ROOT_DIR} STREQUAL "")
  25. SET(JEMALLOC_ROOT_DIR $ENV{JEMALLOC_ROOT_DIR})
  26. ENDIF()
  27. SET(_jemalloc_SEARCH_DIRS
  28. ${JEMALLOC_ROOT_DIR}
  29. /usr/local
  30. /sw # Fink
  31. /opt/local # DarwinPorts
  32. /opt/csw # Blastwave
  33. /opt/lib/jemalloc
  34. )
  35. FIND_PATH(JEMALLOC_INCLUDE_DIR
  36. NAMES
  37. jemalloc.h
  38. HINTS
  39. ${_jemalloc_SEARCH_DIRS}
  40. PATH_SUFFIXES
  41. include/jemalloc
  42. )
  43. FIND_LIBRARY(JEMALLOC_LIBRARY
  44. NAMES
  45. jemalloc
  46. HINTS
  47. ${_jemalloc_SEARCH_DIRS}
  48. PATH_SUFFIXES
  49. lib64 lib
  50. )
  51. # handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if
  52. # all listed variables are TRUE
  53. INCLUDE(FindPackageHandleStandardArgs)
  54. FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
  55. JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
  56. IF(JEMALLOC_FOUND)
  57. SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
  58. SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
  59. ENDIF(JEMALLOC_FOUND)
  60. MARK_AS_ADVANCED(
  61. JEMALLOC_INCLUDE_DIR
  62. JEMALLOC_LIBRARY
  63. )