leetcode/cmake/gperftools.cmake
2023-05-18 17:36:40 +08:00

43 lines
1.3 KiB
CMake

message(STATUS "======= gperftools starting ... =======")
## 设置构建选项,如需要的话
#set(tcmalloc_BUILD_STATIC ON CACHE BOOL "" FORCE)
#set(gperftools_enable_libunwind OFF CACHE BOOL "" FORCE)
#set(gperftools_enable_frame_pointers ON CACHE BOOL "" FORCE)
#
include(FetchContent)
FetchContent_Declare(
gperftools
GIT_REPOSITORY https://github.com/gperftools/gperftools.git
GIT_TAG gperftools-2.10
# GIT_TAG master
)
FetchContent_GetProperties(gperftools)
if(NOT gperftools_POPULATED)
FetchContent_Populate(gperftools)
endif()
set(GPERFTOOLS_SOURCE_DIR ${gperftools_SOURCE_DIR})
set(GPERFTOOLS_INSTALL_DIR ${gperftools_BINARY_DIR})
execute_process(
COMMAND ${GPERFTOOLS_SOURCE_DIR}/autogen.sh
WORKING_DIRECTORY ${GPERFTOOLS_SOURCE_DIR}
)
execute_process(
COMMAND ${GPERFTOOLS_SOURCE_DIR}/configure --prefix=${GPERFTOOLS_INSTALL_DIR}
WORKING_DIRECTORY ${GPERFTOOLS_SOURCE_DIR}
)
execute_process(
COMMAND make -j6
WORKING_DIRECTORY ${GPERFTOOLS_SOURCE_DIR}
)
execute_process(
COMMAND make install
WORKING_DIRECTORY ${GPERFTOOLS_SOURCE_DIR}
)
message(STATUS "============ gperftools source: ${gperftools_SOURCE_DIR}")
message(STATUS "============ gperftools binary: ${gperftools_BINARY_DIR}")
message(STATUS "======= gperftools end =======")