]> git.proxmox.com Git - ceph.git/blob - ceph/cmake/modules/FindJeMalloc.cmake
import 15.2.9
[ceph.git] / ceph / cmake / modules / FindJeMalloc.cmake
1 # Find the native JeMalloc includes and library
2 # This module defines
3 # JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when
4 # JEMALLOC_INCLUDE_DIR is found.
5 # JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc.
6 # JeMalloc_FOUND, If false, do not try to use JeMalloc.
7 #
8
9 find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h)
10
11 find_library(JEMALLOC_LIBRARIES jemalloc)
12
13 include(FindPackageHandleStandardArgs)
14 find_package_handle_standard_args(JeMalloc
15 FOUND_VAR JeMalloc_FOUND
16 REQUIRED_VARS JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
17
18 mark_as_advanced(
19 JEMALLOC_INCLUDE_DIR
20 JEMALLOC_LIBRARIES)
21
22 if(JeMalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc))
23 add_library(JeMalloc::JeMalloc UNKNOWN IMPORTED)
24 set_target_properties(JeMalloc::JeMalloc PROPERTIES
25 INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DIR}"
26 IMPORTED_LINK_INTERFACE_LANGUAGES "C"
27 IMPORTED_LOCATION "${JEMALLOC_LIBRARIES}")
28 endif()