libdwarf provides CMake targets: find_package(libdwarf CONFIG REQUIRED) target_link_libraries(main PRIVATE $,libdwarf::dwarf-static,libdwarf::dwarf-shared>)