Skip to content

CMake modules are broken for SENTRY_BREAKPAD_SYSTEM #877

Closed
@mkszuba

Description

@mkszuba

Description

If sentry-native is built with system-installed Breakpad as the crash handler, the generated CMake file sentry-targets.cmake references PkgConfig::BREAKPAD - without actually looking for it first.

As a result, attempting to include thus configured sentry-native into another CMake project results in an error (see below for the exact message).

A possible solution would be to add a breakpad-related block to sentry-config.cmake.in (after all that file already takes care of locating crashpad and curl). Something along the lines of:

if(SENTRY_BACKEND STREQUAL "breakpad")
    if(@SENTRY_BREAKPAD_SYSTEM@)
        find_package(PkgConfig REQUIRED)
        pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client)
    else()
        # If anything is needed when sentry-native is linked against bundled breakpad, it should go here.
    endif()
endif()

Possibly with one of the if(SENTRY_BACKEND STREQUAL ... lines changed into an elseif.

When does the problem happen

While running CMake in a project depending on sentry-native.

Environment

  • OS: observed on Linux, likely affects all OSes capable of providing system-installed Breakpad;
  • Compiler: N/A
  • CMake version and config: any, SENTRY_BACKEND=breakpad, SENTRY_BREAKPAD_SYSTEM=on

Steps To Reproduce

  • install sentry-native with SENTRY_BACKEND=breakpad, SENTRY_BREAKPAD_SYSTEM=on
  • have another CMake project include it (find_package sentry CONFIG REQUIRED)
  • run CMake on that project

Log output

The actual error message:

CMake Error at /usr/lib64/cmake/sentry/sentry-targets.cmake:70 (set_target_properties):
  The link interface of target "sentry::sentry" contains:

    PkgConfig::BREAKPAD

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

The wider context: see https://bugs.gentoo.org/912886 .

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions