1# If successful, the following variables will be defined: 2# HAVE_LIBPFM. 3# Set BENCHMARK_ENABLE_LIBPFM to 0 to disable, regardless of libpfm presence. 4include(CheckIncludeFile) 5include(CheckLibraryExists) 6include(FeatureSummary) 7enable_language(C) 8 9set_package_properties(PFM PROPERTIES 10 URL http://perfmon2.sourceforge.net/ 11 DESCRIPTION "a helper library to develop monitoring tools" 12 PURPOSE "Used to program specific performance monitoring events") 13 14check_library_exists(libpfm.a pfm_initialize "" HAVE_LIBPFM_INITIALIZE) 15if(HAVE_LIBPFM_INITIALIZE) 16 check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H) 17 check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H) 18 check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H) 19 if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H) 20 message("Using Perf Counters.") 21 set(HAVE_LIBPFM 1) 22 set(PFM_FOUND 1) 23 endif() 24else() 25 message("Perf Counters support requested, but was unable to find libpfm.") 26endif() 27