1# - Find JeMalloc library
2# Find the native JeMalloc includes and library
3#
4# JeMalloc_INCLUDE_DIRS - where to find jemalloc.h, etc.
5# JeMalloc_LIBRARIES - List of libraries when using jemalloc.
6# JeMalloc_FOUND - True if jemalloc found.
7
8find_path(JeMalloc_INCLUDE_DIRS
9  NAMES jemalloc/jemalloc.h
10  HINTS ${JEMALLOC_ROOT_DIR}/include)
11
12find_library(JeMalloc_LIBRARIES
13  NAMES jemalloc
14  HINTS ${JEMALLOC_ROOT_DIR}/lib)
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(JeMalloc DEFAULT_MSG JeMalloc_LIBRARIES JeMalloc_INCLUDE_DIRS)
18
19mark_as_advanced(
20  JeMalloc_LIBRARIES
21  JeMalloc_INCLUDE_DIRS)
22
23if(JeMalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc))
24  add_library (JeMalloc::JeMalloc UNKNOWN IMPORTED)
25  set_target_properties(JeMalloc::JeMalloc
26    PROPERTIES
27      IMPORTED_LOCATION ${JeMalloc_LIBRARIES}
28      INTERFACE_INCLUDE_DIRECTORIES ${JeMalloc_INCLUDE_DIRS})
29endif()
30