Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: provide correct dependencies for CMake client projects... #926

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Fixes**:

- Maintain crashpad client instance during Native SDK lifecycle. ([#910](https://github.com/getsentry/sentry-native/pull/910))
- Specify correct dependencies for CMake client projects using a system-provided breakpad. ([#926](https://github.com/getsentry/sentry-native/pull/926))

**Internal**:

Expand All @@ -17,6 +18,7 @@
Features, fixes and improvements in this release have been contributed by:

- [@compnerd](https://github.com/compnerd)
- [@stima](https://github.com/stima)

## 0.6.7

Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ elseif(SENTRY_BACKEND_BREAKPAD)
# system breakpad is using pkg-config, see `external/breakpad/breakpad-client.pc.in`
find_package(PkgConfig REQUIRED)
pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client)
target_link_libraries(sentry PUBLIC PkgConfig::BREAKPAD)
if(SENTRY_BUILD_SHARED_LIBS)
target_link_libraries(sentry PRIVATE PkgConfig::BREAKPAD)
else()
target_link_libraries(sentry PUBLIC PkgConfig::BREAKPAD)
endif()
else()
add_subdirectory(external)
target_include_directories(sentry PRIVATE
Expand Down
19 changes: 17 additions & 2 deletions sentry-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,34 @@

set(SENTRY_BACKEND @SENTRY_BACKEND@)
set(SENTRY_TRANSPORT @SENTRY_TRANSPORT@)
set(SENTRY_BUILD_SHARED_LIBS @SENTRY_BUILD_SHARED_LIBS@)
set(SENTRY_LINK_PTHREAD @SENTRY_LINK_PTHREAD@)

if(SENTRY_BACKEND STREQUAL "crashpad")
if(@SENTRY_CRASHPAD_SYSTEM@)
set(SENTRY_CRASHPAD_SYSTEM @SENTRY_CRASHPAD_SYSTEM@)
if(SENTRY_CRASHPAD_SYSTEM)
find_package(crashpad REQUIRED)
else()
include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake")
endif()
endif()

if(SENTRY_BACKEND STREQUAL "breakpad" AND NOT SENTRY_BUILD_SHARED_LIBS)
set(SENTRY_BREAKPAD_SYSTEM @SENTRY_BREAKPAD_SYSTEM@)
if(SENTRY_BREAKPAD_SYSTEM)
find_package(PkgConfig REQUIRED)
pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client)
endif()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/sentry-targets.cmake")

if(SENTRY_TRANSPORT STREQUAL "curl" AND NOT @BUILD_SHARED_LIBS@)
if(SENTRY_TRANSPORT STREQUAL "curl" AND (NOT @BUILD_SHARED_LIBS@ OR NOT SENTRY_BUILD_SHARED_LIBS))
find_package(CURL REQUIRED)
set_property(TARGET sentry::sentry APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${CURL_LIBRARIES})
endif()

if(SENTRY_LINK_PTHREAD AND NOT SENTRY_BUILD_SHARED_LIBS)
find_package(Threads REQUIRED)
anonrig marked this conversation as resolved.
Show resolved Hide resolved
endif()