Raef Coles | 1971538 | 2020-07-10 09:50:17 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2020, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | include(FetchContent) |
| 9 | set(FETCHCONTENT_QUIET FALSE) |
| 10 | |
| 11 | # Set to not download submodules if that option is available |
| 12 | if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") |
| 13 | cmake_policy(SET CMP0097 NEW) |
| 14 | endif() |
| 15 | |
| 16 | if ("${MBEDCRYPTO_PATH}" STREQUAL "DOWNLOAD") |
| 17 | find_package(Git) |
| 18 | file(GLOB PATCH_FILES *.patch) |
| 19 | |
| 20 | if (PATCH_FILES) |
| 21 | FetchContent_Declare(mbedcrypto |
| 22 | GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git |
Raef Coles | 9c2ce9b | 2020-10-22 13:07:12 +0100 | [diff] [blame^] | 23 | GIT_TAG ${MBEDCRYPTO_VERSION} |
Raef Coles | 1971538 | 2020-07-10 09:50:17 +0100 | [diff] [blame] | 24 | GIT_SHALLOW TRUE |
| 25 | GIT_PROGRESS TRUE |
| 26 | GIT_SUBMODULES "" |
| 27 | PATCH_COMMAND ${GIT_EXECUTABLE} apply ${PATCH_FILES} |
| 28 | ) |
| 29 | else() |
| 30 | FetchContent_Declare(mbedcrypto |
| 31 | GIT_REPOSITORY https://github.com/ARMmbed/mbedtls.git |
Raef Coles | 9c2ce9b | 2020-10-22 13:07:12 +0100 | [diff] [blame^] | 32 | GIT_TAG ${MBEDCRYPTO_VERSION} |
Raef Coles | 1971538 | 2020-07-10 09:50:17 +0100 | [diff] [blame] | 33 | GIT_SHALLOW TRUE |
| 34 | GIT_PROGRESS TRUE |
| 35 | GIT_SUBMODULES "" |
| 36 | ) |
| 37 | endif() |
| 38 | |
| 39 | FetchContent_GetProperties(mbedcrypto) |
| 40 | if(NOT mbedcrypto_POPULATED) |
| 41 | FetchContent_Populate(mbedcrypto) |
| 42 | set(MBEDCRYPTO_PATH ${mbedcrypto_SOURCE_DIR} CACHE PATH "Path to mbed-crypto (or DOWNLOAD to get automatically" FORCE) |
| 43 | endif() |
| 44 | endif() |