diff --git a/CMakeLists.txt b/CMakeLists.txt index 72901a8c..6248b48c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,13 @@ if(TRACY_LIBUNWIND_BACKTRACE) target_link_libraries(TracyClient INTERFACE ${unwind_LINK_LIBRARIES}) endif() +if(TRACY_DEBUGINFOD) + include(FindPkgConfig) + pkg_check_modules(debuginfod REQUIRED libdebuginfod) + target_include_directories(TracyClient INTERFACE ${debuginfod_INCLUDE_DIRS}) + target_link_libraries(TracyClient INTERFACE ${debuginfod_LINK_LIBRARIES}) +endif() + add_library(Tracy::TracyClient ALIAS TracyClient) macro(set_option option help value) @@ -91,6 +98,7 @@ set_option(TRACY_TIMER_FALLBACK "Use lower resolution timers" OFF) set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported" OFF) set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF) set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF) +set_option(TRACY_DEBUGINFOD "Enable debuginfod support" OFF) # advanced set_option(TRACY_VERBOSE "[advanced] Verbose output from the profiler" OFF) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 98f1386a..1c11b2cd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,5 @@ cmake_minimum_required(VERSION 3.16) -option(USE_DEBUGINFOD "Compile with debuginfod integration" ON) - include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake) # we target C++11 for the client part @@ -25,15 +23,9 @@ target_link_libraries(tracy-test TracyClient) # OS-specific options -if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND USE_DEBUGINFOD) - target_compile_definitions(tracy-test PRIVATE TRACY_DEBUGINFOD) - target_link_libraries(tracy-test "debuginfod") -endif() - if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") target_link_libraries(tracy-test "execinfo") endif() - # copy image file in build folder configure_file(${CMAKE_CURRENT_LIST_DIR}/image.jpg image.jpg COPYONLY)