diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 76e037d8de8..98f9d253b6a 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -39,9 +39,18 @@ endif() if(ACTS_ENABLE_CPU_PROFILING) message(STATUS "added lprofiler") - target_link_libraries( - ActsCore - PUBLIC -lprofiler) + + if(DEFINED GPERF_INSTALL_DIR) + find_library(PROFILER_LIBRARY profiler HINTS ${GPERF_INSTALL_DIR}) + + target_link_libraries( + ActsCore + PUBLIC ${PROFILER_LIBRARY}) + else() + target_link_libraries( + ActsCore + PUBLIC -lprofiler) + endif() target_link_options( ActsCore @@ -50,9 +59,18 @@ endif() if(ACTS_ENABLE_MEMORY_PROFILING) message(STATUS "added ltcmalloc") - target_link_libraries( - ActsCore - PUBLIC -ltcmalloc) + + if(DEFINED GPERF_INSTALL_DIR) + find_library(TCMALLOC_LIBRARY tcmalloc HINTS ${GPERF_INSTALL_DIR}) + + target_link_libraries( + ActsCore + PUBLIC ${TCMALLOC_LIBRARY}) + else() + target_link_libraries( + ActsCore + PUBLIC -ltcmalloc) + endif() endif() install(