forked from LLNL/Caliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindLibpfm.cmake
31 lines (25 loc) · 1.05 KB
/
FindLibpfm.cmake
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
#
# - Find libpfm
#
# LIBPFM_INCLUDE_DIR - Path to libpfm.h
# LIBPFM_LIBRARY - List of libraries for using libpfm
# LIBPFM_FOUND - True if libpfm was found
set(LIBPFM_INSTALL "" CACHE PATH "libpfm install directory")
if(LIBPFM_INSTALL)
# install dir specified, only search them
find_path(LIBPFM_INCLUDE_DIR "perfmon/pfmlib_perf_event.h"
PATHS ${LIBPFM_INSTALL} ${LIBPFM_INSTALL}/include
NO_DEFAULT_PATH)
find_library(LIBPFM_LIBRARY pfm
PATHS ${LIBPFM_INSTALL} ${LIBPFM_INSTALL}/lib
NO_DEFAULT_PATH)
else()
# no install dir specified, look in default and PAPI
find_path(LIBPFM_INCLUDE_DIR "perfmon/pfmlib_perf_event.h"
HINTS ${PAPI_INCLUDE_DIRS} ${PAPI_INCLUDE_DIRS}/libpfm4/include)
find_library(LIBPFM_LIBRARY pfm
HINTS ${PAPI_LIBRARIES} ${PAPI_LIBRARIES}/libpfm4/include)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libpfm DEFAULT_MSG LIBPFM_LIBRARY LIBPFM_INCLUDE_DIR)
mark_as_advanced(LIBPFM_LIBRARY LIBPFM_INCLUDE_DIR)