gtsam/cmake/FindGooglePerfTools.cmake

38 lines
1.1 KiB
CMake
Raw Normal View History

# -*- cmake -*-
2024-12-02 07:55:55 +08:00
# - Find GPerfTools (formerly Google perftools)
# Find the GPerfTools libraries
# If false, do not try to use Google perftools.
# also defined for general use are
# TCMALLOC_LIBRARY, where to find the tcmalloc library.
SET(TCMALLOC_NAMES ${TCMALLOC_NAMES} tcmalloc)
2024-12-02 07:55:55 +08:00
find_library(TCMALLOC_LIBRARY
NAMES ${TCMALLOC_NAMES}
PATHS /usr/lib /usr/local/lib
2024-12-02 07:55:55 +08:00
)
find_library(GPERFTOOLS_PROFILER
NAMES profiler
PATHS /usr/lib /usr/local/lib
)
2024-12-02 07:55:55 +08:00
IF (TCMALLOC_LIBRARY AND GPERFTOOLS_PROFILER)
SET(TCMALLOC_LIBRARIES ${TCMALLOC_LIBRARY})
SET(GOOGLE_PERFTOOLS_FOUND "YES")
2024-12-02 07:55:55 +08:00
ELSE (TCMALLOC_LIBRARY AND GPERFTOOLS_PROFILER)
SET(GOOGLE_PERFTOOLS_FOUND "NO")
2024-12-02 07:55:55 +08:00
ENDIF (TCMALLOC_LIBRARY AND GPERFTOOLS_PROFILER)
IF (GOOGLE_PERFTOOLS_FOUND)
2024-12-02 07:55:55 +08:00
MESSAGE(STATUS "Found Google perftools: ${GPERFTOOLS_PROFILER}")
ELSE (GOOGLE_PERFTOOLS_FOUND)
IF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Google perftools library")
ENDIF (GOOGLE_PERFTOOLS_FIND_REQUIRED)
ENDIF (GOOGLE_PERFTOOLS_FOUND)
MARK_AS_ADVANCED(
TCMALLOC_LIBRARY
2024-12-02 07:55:55 +08:00
GPERFTOOLS_PROFILER
)