Skip to content

Commit 8c748b4

Browse files
authored
fix: remove the SENTRY_CRASHPAD_SYSTEM build option (#928)
1 parent 164da79 commit 8c748b4

File tree

4 files changed

+62
-73
lines changed

4 files changed

+62
-73
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
**Breaking changes**:
66

77
- Make `crashpad` the default backend for Linux. ([#927](https://github.com/getsentry/sentry-native/pull/927))
8+
- Remove build option `SENTRY_CRASHPAD_SYSTEM`. ([#928](https://github.com/getsentry/sentry-native/pull/928))
89

910
**Fixes**:
1011

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

1415
**Internal**:

CMakeLists.txt

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -413,74 +413,68 @@ if(SENTRY_WITH_LIBUNWINDSTACK)
413413
endif()
414414

415415
if(SENTRY_BACKEND_CRASHPAD)
416-
option(SENTRY_CRASHPAD_SYSTEM "Use system crashpad" OFF)
417-
if(SENTRY_CRASHPAD_SYSTEM)
418-
find_package(crashpad REQUIRED)
419-
target_link_libraries(sentry PUBLIC crashpad::client)
416+
# FIXME: required for cmake 3.12 and lower:
417+
# - NEW behavior lets normal variable override option
418+
cmake_policy(SET CMP0077 NEW)
419+
if(SENTRY_BUILD_SHARED_LIBS)
420+
set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE)
420421
else()
421-
# FIXME: required for cmake 3.12 and lower:
422-
# - NEW behavior lets normal variable override option
423-
cmake_policy(SET CMP0077 NEW)
424-
if(SENTRY_BUILD_SHARED_LIBS)
425-
set(CRASHPAD_ENABLE_INSTALL OFF CACHE BOOL "Enable crashpad installation" FORCE)
426-
else()
427-
set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE)
428-
endif()
429-
add_subdirectory(external/crashpad crashpad_build)
422+
set(CRASHPAD_ENABLE_INSTALL ON CACHE BOOL "Enable crashpad installation" FORCE)
423+
endif()
424+
add_subdirectory(external/crashpad crashpad_build)
430425

431-
if(CRASHPAD_WER_ENABLED)
432-
add_dependencies(sentry crashpad::wer)
433-
endif()
426+
if(CRASHPAD_WER_ENABLED)
427+
add_dependencies(sentry crashpad::wer)
428+
endif()
434429

435-
# set static runtime if enabled
436-
if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC)
437-
set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
438-
set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
439-
set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
440-
set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
441-
set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
442-
set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
443-
set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
444-
set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
445-
set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
446-
if(CRASHPAD_WER_ENABLED)
447-
set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
448-
endif()
449-
set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
450-
set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
430+
# set static runtime if enabled
431+
if(SENTRY_BUILD_RUNTIMESTATIC AND MSVC)
432+
set_property(TARGET crashpad_client PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
433+
set_property(TARGET crashpad_compat PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
434+
set_property(TARGET crashpad_getopt PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
435+
set_property(TARGET crashpad_handler PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
436+
set_property(TARGET crashpad_handler_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
437+
set_property(TARGET crashpad_minidump PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
438+
set_property(TARGET crashpad_snapshot PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
439+
set_property(TARGET crashpad_tools PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
440+
set_property(TARGET crashpad_util PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
441+
if(CRASHPAD_WER_ENABLED)
442+
set_property(TARGET crashpad_wer PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
451443
endif()
444+
set_property(TARGET crashpad_zlib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
445+
set_property(TARGET mini_chromium PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
446+
endif()
452447

453-
if(DEFINED SENTRY_FOLDER)
454-
set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER})
455-
set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER})
456-
set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER})
457-
set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER})
458-
set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER})
459-
set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER})
460-
set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER})
461-
set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER})
462-
set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER})
463-
set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER})
464-
set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER})
465-
if(CRASHPAD_WER_ENABLED)
466-
set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER})
467-
endif()
448+
if(DEFINED SENTRY_FOLDER)
449+
set_target_properties(crashpad_client PROPERTIES FOLDER ${SENTRY_FOLDER})
450+
set_target_properties(crashpad_compat PROPERTIES FOLDER ${SENTRY_FOLDER})
451+
set_target_properties(crashpad_getopt PROPERTIES FOLDER ${SENTRY_FOLDER})
452+
set_target_properties(crashpad_handler PROPERTIES FOLDER ${SENTRY_FOLDER})
453+
set_target_properties(crashpad_handler_lib PROPERTIES FOLDER ${SENTRY_FOLDER})
454+
set_target_properties(crashpad_minidump PROPERTIES FOLDER ${SENTRY_FOLDER})
455+
set_target_properties(crashpad_snapshot PROPERTIES FOLDER ${SENTRY_FOLDER})
456+
set_target_properties(crashpad_tools PROPERTIES FOLDER ${SENTRY_FOLDER})
457+
set_target_properties(crashpad_util PROPERTIES FOLDER ${SENTRY_FOLDER})
458+
set_target_properties(crashpad_zlib PROPERTIES FOLDER ${SENTRY_FOLDER})
459+
set_target_properties(mini_chromium PROPERTIES FOLDER ${SENTRY_FOLDER})
460+
if(CRASHPAD_WER_ENABLED)
461+
set_target_properties(crashpad_wer PROPERTIES FOLDER ${SENTRY_FOLDER})
468462
endif()
463+
endif()
469464

470-
target_link_libraries(sentry PRIVATE
471-
$<BUILD_INTERFACE:crashpad::client>
472-
$<INSTALL_INTERFACE:sentry_crashpad::client>
473-
)
474-
install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake
475-
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
476-
)
477-
if(WIN32 AND MSVC)
478-
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_handler>
465+
target_link_libraries(sentry PRIVATE
466+
$<BUILD_INTERFACE:crashpad::client>
467+
$<INSTALL_INTERFACE:sentry_crashpad::client>
468+
)
469+
install(EXPORT crashpad_export NAMESPACE sentry_crashpad:: FILE sentry_crashpad-targets.cmake
470+
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
471+
)
472+
if(WIN32 AND MSVC)
473+
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_handler>
474+
DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
475+
if (CRASHPAD_WER_ENABLED)
476+
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_wer>
479477
DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
480-
if (CRASHPAD_WER_ENABLED)
481-
sentry_install(FILES $<TARGET_PDB_FILE:crashpad_wer>
482-
DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
483-
endif()
484478
endif()
485479
endif()
486480
add_dependencies(sentry crashpad::handler)

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,8 @@ using `cmake -D BUILD_SHARED_LIBS=OFF ..`.
238238
- `SENTRY_INTEGRATION_QT` (Default: OFF):
239239
Builds the Qt integration, which turns Qt log messages into breadcrumbs.
240240

241-
- `SENTRY_BREAKPAD_SYSTEM` / `SENTRY_CRASHPAD_SYSTEM` (Default: OFF):
242-
This instructs the build system to use system-installed breakpad or crashpad
243-
libraries instead of using the in-tree version. This is generally not recommended
244-
for crashpad, as sentry uses a patched version that has attachment support.
245-
This is being worked on upstream as well, and a future version might work with
246-
an unmodified crashpad version as well.
241+
- `SENTRY_BREAKPAD_SYSTEM` (Default: OFF):
242+
This instructs the build system to use system-installed breakpad libraries instead of using the in-tree version.
247243

248244
| Feature | Windows | macOS | Linux | Android | iOS |
249245
| ---------- | ------- | ----- | ----- | ------- | --- |

sentry-config.cmake.in

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ set(SENTRY_TRANSPORT @SENTRY_TRANSPORT@)
55
set(SENTRY_BUILD_SHARED_LIBS @SENTRY_BUILD_SHARED_LIBS@)
66
set(SENTRY_LINK_PTHREAD @SENTRY_LINK_PTHREAD@)
77

8-
if(SENTRY_BACKEND STREQUAL "crashpad")
9-
set(SENTRY_CRASHPAD_SYSTEM @SENTRY_CRASHPAD_SYSTEM@)
10-
if(SENTRY_CRASHPAD_SYSTEM)
11-
find_package(crashpad REQUIRED)
12-
else()
13-
include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake")
8+
if(SENTRY_BACKEND STREQUAL "crashpad" AND NOT SENTRY_BUILD_SHARED_LIBS)
9+
include("${CMAKE_CURRENT_LIST_DIR}/sentry_crashpad-targets.cmake")
10+
if(NOT MSVC AND NOT SENTRY_BUILD_SHARED_LIBS)
11+
find_package(ZLIB REQUIRED)
1412
endif()
1513
endif()
1614

0 commit comments

Comments
 (0)