@@ -413,74 +413,68 @@ if(SENTRY_WITH_LIBUNWINDSTACK)
413413endif ()
414414
415415if (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)
0 commit comments