From ddd4f57fe83f3618108a1f95e3eb13db73ca9cda Mon Sep 17 00:00:00 2001 From: "771730766@qq.com" Date: Tue, 30 Jan 2018 11:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0jemalloc=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- cmake/FindJEMALLOC.cmake | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 cmake/FindJEMALLOC.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c5358938..f2bcec71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ if(ZLTOOLKIT_FOUND) list(APPEND LINK_LIB_LIST ${ZLTOOLKIT_LIBRARIES}) endif() -#查找ZLToolKit是否安装 +#查找JEMALLOC是否安装 find_package(JEMALLOC QUIET) if(JEMALLOC_FOUND) message(STATUS "找到JEMALLOC库:\"${JEMALLOC_INCLUDE_DIR}\"") diff --git a/cmake/FindJEMALLOC.cmake b/cmake/FindJEMALLOC.cmake new file mode 100644 index 00000000..35184347 --- /dev/null +++ b/cmake/FindJEMALLOC.cmake @@ -0,0 +1,16 @@ + + +find_path(JEMALLOC_INCLUDE_DIR + NAMES jemalloc/jemalloc.h + ) + +find_library(JEMALLOC_LIBRARY + NAMES jemalloc + ) + +set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) +set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(JEMALLOC DEFAULT_MSG JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)