aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/FindPFM.cmake
blob: 4c1ce938f9f7a0f7fe154967ae5be167b2ec6092 (plain)
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
# If successful, the following variables will be defined:
# PFM_FOUND.
# PFM_LIBRARIES
# PFM_INCLUDE_DIRS
# the following target will be defined:
# PFM::libpfm

include(FeatureSummary)
include(FindPackageHandleStandardArgs)

set_package_properties(PFM PROPERTIES
                       URL http://perfmon2.sourceforge.net/
                       DESCRIPTION "A helper library to develop monitoring tools"
                       PURPOSE "Used to program specific performance monitoring events")

find_library(PFM_LIBRARY NAMES pfm)
find_path(PFM_INCLUDE_DIR NAMES perfmon/pfmlib.h)

find_package_handle_standard_args(PFM REQUIRED_VARS PFM_LIBRARY PFM_INCLUDE_DIR)

if (PFM_FOUND AND NOT TARGET PFM::libpfm)
    add_library(PFM::libpfm UNKNOWN IMPORTED)
    set_target_properties(PFM::libpfm PROPERTIES
        IMPORTED_LOCATION "${PFM_LIBRARY}"
        INTERFACE_INCLUDE_DIRECTORIES "${PFM_INCLUDE_DIR}")
endif()

mark_as_advanced(PFM_LIBRARY PFM_INCLUDE_DIR)