Add support for crashpad on Linux

This commit is contained in:
Dale Glass 2020-05-18 17:58:28 +02:00
parent 70e3c1769f
commit 486d961f48
2 changed files with 23 additions and 5 deletions

View file

@ -35,6 +35,25 @@ elseif (APPLE)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
set(BIN_RELEASE_PATH "${SOURCE_DIR}/out/Release")
set(BIN_EXT "")
set(LIB_RELEASE_PATH "${SOURCE_DIR}/out/Release/lib")
set(LIB_DEBUG_PATH "${SOURCE_DIR}/out/Debug/lib")
set(LIB_PREFIX "lib")
set(LIB_EXT "a")
elseif (UNIX)
ExternalProject_Add(
${EXTERNAL_NAME}
URL "${EXTERNAL_BUILD_ASSETS}/dependencies/crashpad_linux_c7d1d2a1.tar.bz2"
URL_MD5 356bee858e7338e7b06a351bce92db36
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
)
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
set(BIN_RELEASE_PATH "${SOURCE_DIR}/out/Release")
set(BIN_EXT "")
set(LIB_RELEASE_PATH "${SOURCE_DIR}/out/Release/lib")
@ -43,8 +62,7 @@ elseif (APPLE)
set(LIB_EXT "a")
endif ()
if (WIN32 OR APPLE)
if (WIN32 OR APPLE OR UNIX)
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE PATH "List of Crashpad include directories")
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${LIB_RELEASE_PATH}/${LIB_PREFIX}crashpad_client.${LIB_EXT} CACHE FILEPATH "Path to Crashpad release library")

View file

@ -23,12 +23,12 @@ macro(add_crashpad)
set(CMAKE_BACKTRACE_TOKEN $ENV{CMAKE_BACKTRACE_TOKEN})
endif()
if ((WIN32 OR APPLE) AND USE_CRASHPAD)
if (USE_CRASHPAD)
get_property(CRASHPAD_CHECKED GLOBAL PROPERTY CHECKED_FOR_CRASHPAD_ONCE)
if (NOT CRASHPAD_CHECKED)
add_dependency_external_projects(crashpad)
find_package(crashpad REQUIRED)
find_package(Crashpad REQUIRED)
set_property(GLOBAL PROPERTY CHECKED_FOR_CRASHPAD_ONCE TRUE)
endif()
@ -38,7 +38,7 @@ macro(add_crashpad)
add_definitions(-DCMAKE_BACKTRACE_TOKEN=\"${CMAKE_BACKTRACE_TOKEN}\")
target_include_directories(${TARGET_NAME} PRIVATE ${CRASHPAD_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${CRASHPAD_LIBRARY} ${CRASHPAD_BASE_LIBRARY} ${CRASHPAD_UTIL_LIBRARY})
target_link_libraries(${TARGET_NAME} ${CRASHPAD_LIBRARY} ${CRASHPAD_UTIL_LIBRARY} ${CRASHPAD_BASE_LIBRARY})
if (WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES LINK_FLAGS "/ignore:4099")