2015-12-31 02:06:08 +00:00
|
|
|
# Find the native JeMalloc includes and library
|
|
|
|
# This module defines
|
|
|
|
# JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when
|
|
|
|
# JEMALLOC_INCLUDE_DIR is found.
|
|
|
|
# JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc.
|
2018-07-26 05:28:02 +00:00
|
|
|
# JeMalloc_FOUND, If false, do not try to use JeMalloc.
|
2015-12-31 02:06:08 +00:00
|
|
|
#
|
|
|
|
|
2016-12-10 04:47:38 +00:00
|
|
|
find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h)
|
2015-12-31 02:06:08 +00:00
|
|
|
|
2016-12-10 04:47:38 +00:00
|
|
|
find_library(JEMALLOC_LIBRARIES jemalloc)
|
2015-12-31 02:06:08 +00:00
|
|
|
|
2016-12-10 04:47:38 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2018-07-26 05:28:02 +00:00
|
|
|
find_package_handle_standard_args(JeMalloc
|
|
|
|
FOUND_VAR JeMalloc_FOUND
|
|
|
|
REQUIRED_VARS JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
|
2015-12-31 02:06:08 +00:00
|
|
|
|
2016-12-10 04:47:38 +00:00
|
|
|
mark_as_advanced(
|
2015-12-31 02:06:08 +00:00
|
|
|
JEMALLOC_INCLUDE_DIR
|
2016-12-10 04:47:38 +00:00
|
|
|
JEMALLOC_LIBRARIES)
|
|
|
|
|
2018-07-26 05:28:02 +00:00
|
|
|
if(JeMalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc))
|
|
|
|
add_library(JeMalloc::JeMalloc UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(JeMalloc::JeMalloc PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${JEMALLOC_INCLUDE_DIR}"
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${JEMALLOC_LIBRARIES}")
|
|
|
|
endif()
|