cmake_minimum_required(VERSION 3.19...3.31) set(sentry_cli_version "3.1.0") # Note: When updating, must also update all of the sentry_cli_dl_sha512 below! # Manually query the CMAKE_HOST_SYSTEM_PROCESSOR # See: https://gitlab.kitware.com/cmake/cmake/-/issues/25151 cmake_host_system_information(RESULT CMAKE_HOST_SYSTEM_PROCESSOR QUERY OS_PLATFORM) message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR=${CMAKE_HOST_SYSTEM_PROCESSOR}") # Construct the appropriate URL based on the current platform set(sentry_cli_dl_url "") set(sentry_cli_dl_sha512 "") set(_exe_suffix "") if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^x86$") message(FATAL_ERROR "Script does not currently support platform: ${CMAKE_HOST_SYSTEM_NAME} and ARCH: ${CMAKE_HOST_SYSTEM_PROCESSOR}") else() # just default to x64 otherwise set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Windows-x86_64.exe") set(sentry_cli_dl_sha512 "925a76dd7a2c47e0239b63874ce87d857810ecd3207ee48323977f96e291e8815966f13920b209a620aa58d925aaed79ac6e10e2054dab4e218fc2e2a53d680a") endif() set(_exe_suffix ".exe") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Darwin-universal") set(sentry_cli_dl_sha512 "4d7ae6ed4152b7886645da9f53ba232caccb9d371aea61a3c3bdbb045f80cd366afe8e6eb56efbb8e8faa8163fcdf9961dde46eabfcee67937267dda75df1881") elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^x86_64$") set(sentry_cli_dl_url "https://github.com/getsentry/sentry-cli/releases/download/${sentry_cli_version}/sentry-cli-Linux-x86_64") set(sentry_cli_dl_sha512 "ee19ad96dfa9915ac8fa8c3969bb29bf637bcfce9af7cf9886d84944c03d9bc5708254c63508bd758fd4be83a16e9458f3938d8dad39647c8d8db06b24edcd90") else() message(FATAL_ERROR "Script does not currently support platform: ${CMAKE_HOST_SYSTEM_NAME} and ARCH: ${CMAKE_HOST_SYSTEM_PROCESSOR}") endif() else() message(FATAL_ERROR "Script does not currently support platform: ${CMAKE_HOST_SYSTEM_NAME}") endif() set(_output_fullpath "${CMAKE_CURRENT_BINARY_DIR}/sentry-cli/sentry-cli${_exe_suffix}") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sentry-cli") file(DOWNLOAD "${sentry_cli_dl_url}" "${_output_fullpath}" SHOW_PROGRESS TLS_VERIFY ON EXPECTED_HASH SHA512=${sentry_cli_dl_sha512}) file(CHMOD "${_output_fullpath}" FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ ) message(STATUS "Downloaded sentry-cli (${sentry_cli_version}) to: \"${_output_fullpath}\"")