xref: /llvm-project/third-party/benchmark/cmake/Modules/FindPFM.cmake (revision a5b797172cc902db166e9a695716fb81405f86e4)
1a290770fSMircea Trofin# If successful, the following variables will be defined:
2*a5b79717SMircea Trofin# PFM_FOUND.
3*a5b79717SMircea Trofin# PFM_LIBRARIES
4*a5b79717SMircea Trofin# PFM_INCLUDE_DIRS
5*a5b79717SMircea Trofin# the following target will be defined:
6*a5b79717SMircea Trofin# PFM::libpfm
7*a5b79717SMircea Trofin
8a290770fSMircea Trofininclude(FeatureSummary)
9*a5b79717SMircea Trofininclude(FindPackageHandleStandardArgs)
10a290770fSMircea Trofin
11a290770fSMircea Trofinset_package_properties(PFM PROPERTIES
12a290770fSMircea Trofin                       URL http://perfmon2.sourceforge.net/
13*a5b79717SMircea Trofin                       DESCRIPTION "A helper library to develop monitoring tools"
14a290770fSMircea Trofin                       PURPOSE "Used to program specific performance monitoring events")
15a290770fSMircea Trofin
16*a5b79717SMircea Trofinfind_library(PFM_LIBRARY NAMES pfm)
17*a5b79717SMircea Trofinfind_path(PFM_INCLUDE_DIR NAMES perfmon/pfmlib.h)
18*a5b79717SMircea Trofin
19*a5b79717SMircea Trofinfind_package_handle_standard_args(PFM REQUIRED_VARS PFM_LIBRARY PFM_INCLUDE_DIR)
20*a5b79717SMircea Trofin
21*a5b79717SMircea Trofinif (PFM_FOUND AND NOT TARGET PFM::libpfm)
22*a5b79717SMircea Trofin    add_library(PFM::libpfm UNKNOWN IMPORTED)
23*a5b79717SMircea Trofin    set_target_properties(PFM::libpfm PROPERTIES
24*a5b79717SMircea Trofin        IMPORTED_LOCATION "${PFM_LIBRARY}"
25*a5b79717SMircea Trofin        INTERFACE_INCLUDE_DIRECTORIES "${PFM_INCLUDE_DIR}")
26a290770fSMircea Trofinendif()
27*a5b79717SMircea Trofin
28*a5b79717SMircea Trofinmark_as_advanced(PFM_LIBRARY PFM_INCLUDE_DIR)
29