Skip to content

Broken sentry-config.cmake when using crashpad #504

@ericriff

Description

@ericriff

Description

find_package(sentry CONFIG) is broken if crashpad is used as backend since a library and an executable with the same name get exported in lib/cmake/sentry/sentry_crashpad-targets.cmake:

# Create imported target sentry_crashpad::handler
add_library(sentry_crashpad::handler STATIC IMPORTED)

set_target_properties(sentry_crashpad::handler PROPERTIES
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:>;sentry_crashpad::compat;sentry_crashpad::minidump;sentry_crashpad::snapshot;sentry_crashpad::util;sentry_crashpad::mini_chromium"
)

# Create imported target sentry_crashpad::handler
add_executable(sentry_crashpad::handler IMPORTED)

Which leads to the following error when consuming sentry-config.cmake:

-- The CXX compiler identification is GNU 8.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /home/eric/setry-native/install/lib/cmake/sentry/sentry_crashpad-targets.cmake:120 (add_executable):
  add_executable cannot create imported target "sentry_crashpad::handler"
  because another target with the same name already exists.
Call Stack (most recent call first):
  /home/eric/setry-native/install/lib/cmake/sentry/sentry-config.cmake:34 (include)
  CMakeLists.txt:11 (find_package)
  • During build
  • During run-time
  • When capturing a hard crash

Environment

  • OS: Ubuntu 18
  • Compiler: gcc 8

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