diff --git a/tools/llvm-exegesis/CMakeLists.txt b/tools/llvm-exegesis/CMakeLists.txt index def182b4104..8ba8328e9d2 100644 --- a/tools/llvm-exegesis/CMakeLists.txt +++ b/tools/llvm-exegesis/CMakeLists.txt @@ -9,7 +9,3 @@ add_llvm_tool(llvm-exegesis add_subdirectory(lib) target_link_libraries(llvm-exegesis PRIVATE LLVMExegesis) - -if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM) - target_link_libraries(llvm-exegesis PRIVATE pfm) -endif() diff --git a/tools/llvm-exegesis/lib/CMakeLists.txt b/tools/llvm-exegesis/lib/CMakeLists.txt index b326757fb6b..3f82fd2bbd9 100644 --- a/tools/llvm-exegesis/lib/CMakeLists.txt +++ b/tools/llvm-exegesis/lib/CMakeLists.txt @@ -27,5 +27,9 @@ llvm_map_components_to_libnames(libs Support ) +if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM) + list(APPEND libs pfm) +endif() + target_link_libraries(LLVMExegesis ${libs}) set_target_properties(LLVMExegesis PROPERTIES FOLDER "Libraries") diff --git a/unittests/tools/llvm-exegesis/CMakeLists.txt b/unittests/tools/llvm-exegesis/CMakeLists.txt index 95426aa1564..867df415b93 100644 --- a/unittests/tools/llvm-exegesis/CMakeLists.txt +++ b/unittests/tools/llvm-exegesis/CMakeLists.txt @@ -17,10 +17,6 @@ add_llvm_unittest(LLVMExegesisTests ) target_link_libraries(LLVMExegesisTests PRIVATE LLVMExegesis) -if(LLVM_ENABLE_LIBPFM AND HAVE_LIBPFM) - target_link_libraries(LLVMExegesisTests PRIVATE pfm) -endif() - if(LLVM_TARGETS_TO_BUILD MATCHES "X86") add_subdirectory(X86) endif()