From c2146397ac69e6589a50f6b4fc6a7355669caed5 Mon Sep 17 00:00:00 2001 From: Stephen Nicholas Swatman Date: Wed, 19 Jun 2024 20:03:42 +0200 Subject: [PATCH] Find libpfm dependency in installed CMake configs (#1806) Currently, Google Benchmark can be built and installed with support for libpfm, but this can cause a problem if that installation is later called upon by another CMake project. Indeed, while the installed CMake configuration script correctly identifies that it needs to link against libpfm, it doesn't try to find libpfm, meaning that the target will be unavailable. This commit fixes this potential configuration-time error by ensuring that an installation of Google Benchmark will correctly try to find the libpfm dependency when it is used elsewhere. --- cmake/Config.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in index 2e15f0cf..3659cfa2 100644 --- a/cmake/Config.cmake.in +++ b/cmake/Config.cmake.in @@ -4,4 +4,8 @@ include (CMakeFindDependencyMacro) find_dependency (Threads) +if (@BENCHMARK_ENABLE_LIBPFM@) + find_dependency (PFM) +endif() + include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")