FindGooglePerfTools.cmake 1.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
# - Try to find Google Perftools
# Once done this will define
#  
# TCMALLOC_LIBRARY   		    - path to libtcmalloc.so
# PROFILER_LIBRARY		    - path to libprofiler.so
# GOOGLEPERFTOOLS_FOUND             - system has UTIL
# GOOGLEPERFTOOLS_INCLUDE_DIR       - the UTIL include directory
# GOOGLEPERFTOOLS_LIBRARY           - Link these to use UTIL
# GOOGLEPERFTOOLS_LIBRARY_DIR       - Library DIR of UTIL

FIND_LIBRARY( TCMALLOC_LIBRARY tcmalloc
	/usr/local/lib
	/usr/lib
	)

FIND_LIBRARY( PROFILER_LIBRARY profiler
	/usr/local/lib
	/usr/lib
	)

FIND_PATH( GOOGLEPERFTOOLS_LIBRARY_DIR libtcmalloc_and_profiler.so
	/usr/local/lib
	/usr/lib/
	)

FIND_PATH( GOOGLEPERFTOOLS_INCLUDE_DIR google/heap-profiler.h
	/usr/local/include
	/usr/include
	)

IF ( TCMALLOC_LIBRARY AND PROFILER_LIBRARY AND GOOGLEPERFTOOLS_INCLUDE_DIR AND GOOGLEPERFTOOLS_LIBRARY_DIR )
	SET( GOOGLEPERFTOOLS_FOUND "YES" )
	SET( GOOGLEPERFTOOLS_LIBRARY ${TCMALLOC_LIBRARY} ${PROFILER_LIBRARY} )
ENDIF ( TCMALLOC_LIBRARY AND PROFILER_LIBRARY AND GOOGLEPERFTOOLS_INCLUDE_DIR AND GOOGLEPERFTOOLS_LIBRARY_DIR )

IF ( GOOGLEPERFTOOLS_FOUND )
ELSE ( GOOGLEPERFTOOLS_FOUND )
	MESSAGE( AUTHOR_WARNING "Could not find g(oogle-)perftools library.
	TCMALLOC_LIBRARY: ${TCMALLOC_LIBRARY},
	PROFILER_LIBRARY: ${PROFILER_LIBRARY},
	GOOGLEPERFTOOLS_LIBRARY_DIR: ${GOOGLEPERFTOOLS_LIBRARY_DIR}
	GOOGLEPERFTOOLS_INCLUDE_DIR: ${GOOGLEPERFTOOLS_INCLUDE_DIR}
	GOOGLEPERFTOOLS_LIBRARY: ${GOOGLEPERFTOOLS_LIBRARY}
	")
ENDIF ( GOOGLEPERFTOOLS_FOUND )

MARK_AS_ADVANCED(
	GOOGLEPERFTOOLS_LIBRARY
	GOOGLEPERFTOOLS_LIBRARY_DIR
	GOOGLEPERFTOOLS_INCLUDE_DIR
	)