From 781c30f63f434288a3c0c632b6d3708df2d52778 Mon Sep 17 00:00:00 2001 From: Jeremy <51220084+jeremy-rifkin@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:16:33 -0500 Subject: [PATCH] Fix build --- CMakeLists.txt | 1 + src/platform/dwarf.hpp | 5 +++++ src/symbols/symbols_with_libdwarf.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e14bb79..cf0ccf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,6 +307,7 @@ if(CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) target_compile_definitions(${target_name} PUBLIC CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF) if(CPPTRACE_USE_EXTERNAL_LIBDWARF) find_package(libdwarf REQUIRED) + target_compile_definitions(${target_name} PRIVATE CPPTRACE_USE_EXTERNAL_LIBDWARF) else() set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(PIC_ALWAYS TRUE) diff --git a/src/platform/dwarf.hpp b/src/platform/dwarf.hpp index 607eca7..d9c4e87 100644 --- a/src/platform/dwarf.hpp +++ b/src/platform/dwarf.hpp @@ -9,8 +9,13 @@ #include #include +#ifdef CPPTRACE_USE_EXTERNAL_LIBDWARF +#include +#include +#else #include #include +#endif namespace cpptrace { namespace detail { diff --git a/src/symbols/symbols_with_libdwarf.cpp b/src/symbols/symbols_with_libdwarf.cpp index 8a5e7a2..e3a1bb9 100644 --- a/src/symbols/symbols_with_libdwarf.cpp +++ b/src/symbols/symbols_with_libdwarf.cpp @@ -20,8 +20,13 @@ #include #include +#ifdef CPPTRACE_USE_EXTERNAL_LIBDWARF +#include +#include +#else #include #include +#endif // It's been tricky to piece together how to handle all this dwarf stuff. Some resources I've used are // https://www.prevanders.net/libdwarf.pdf