Skip to content

Compilation / Integration in own program via FetchContent does not work on Ubuntu 22.04 #341

Description

@firesurfer

Hi I originally came from:

pal-robotics/backward_ros#21 (Which btw. still doesn't work). I therefore tried to include backward-cpp directly in my program. When I followed the guide in the readme I first ran into the following issues:

  1. cmake couldn't clone the repository -> This was due to the SYSTEM argument in the Fetch call. This argument is only supported in cmake > 3.25. Ubuntu 22.04 ships 3.22.1. -> Removing SYSTEM fixes that
  2. None of the targets Backward::Interface, Backward::Object, or Backward::Backward can be found by cmake.

Solution: Directly link against backward_object

So in order to get it working on Ubuntu 22.04 I have now the following CMakeLists.txt

# Also requires one of: libbfd (gnu binutils), libdwarf, libdw (elfutils)
FetchContent_Declare(Backward    #Note: For some reason I ran into issues when the target here is called backwards with a small b at the beginning
    GIT_REPOSITORY https://github.com/bombela/backward-cpp
    GIT_TAG master  # or a version tag, such as v1.6
 
)
FetchContent_MakeAvailable(Backward)

add_executable....
target_link_libraries(my_executable backward_object)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions