blob: 202bb030e3803273ace553266d26303fb1b94de1 [file] [log] [blame]
Clement Courbete7bb73e2018-04-11 07:39:00 +00001# CMake module for finding libpfm4.
2#
3# If successful, the following variables will be defined:
4# HAVE_LIBPFM
5#
6# Libpfm can be disabled by setting LLVM_ENABLE_LIBPFM to 0.
7
8include(CheckIncludeFile)
9include(CheckLibraryExists)
10
11if (LLVM_ENABLE_LIBPFM)
12 check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE)
13 if(HAVE_LIBPFM_INITIALIZE)
14 check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H)
15 check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H)
16 check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
17 if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
18 set(HAVE_LIBPFM 1)
19 endif()
20 endif()
21endif()
22
23