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 | |
David Hu | eeb61d2 | 2022-07-29 15:12:25 +0200 | [diff] [blame^] | 8 | include(FetchContent) |
| 9 | set(FETCHCONTENT_QUIET FALSE) |
| 10 | |
| 11 | # Set to not download submodules if that option is available. |
Øyvind Rønningstad | c72d955 | 2020-10-30 21:29:40 +0100 | [diff] [blame] | 12 | # Because of https://gitlab.kitware.com/cmake/cmake/-/issues/20579 CMP0097 is |
| 13 | # non-functional until cmake 3.18.0. |
David Hu | eeb61d2 | 2022-07-29 15:12:25 +0200 | [diff] [blame^] | 14 | if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0") |
| 15 | cmake_policy(SET CMP0097 NEW) |
| 16 | set(MCUBOOT_SUBMODULES "") |
| 17 | else() |
| 18 | # Workaround for not having CMP0097. Fetch the smallest submodule. |
| 19 | set(MCUBOOT_SUBMODULES "boot/cypress/libs/cy-mbedtls-acceleration/") |
Raef Coles | 1971538 | 2020-07-10 09:50:17 +0100 | [diff] [blame] | 20 | endif() |
| 21 | |
David Hu | eeb61d2 | 2022-07-29 15:12:25 +0200 | [diff] [blame^] | 22 | if ("${MCUBOOT_PATH}" STREQUAL "DOWNLOAD") |
| 23 | FetchContent_Declare(mcuboot |
| 24 | GIT_REPOSITORY https://github.com/mcu-tools/mcuboot.git |
| 25 | GIT_TAG ${MCUBOOT_VERSION} |
| 26 | GIT_SHALLOW FALSE |
| 27 | GIT_PROGRESS TRUE |
| 28 | GIT_SUBMODULES "${MCUBOOT_SUBMODULES}" |
| 29 | ) |
| 30 | # ToDo: set GIT_SHALLOW to 'TRUE' when MCUBOOT_VERSION will be set to a tag |
| 31 | # (instead of a commit hash) with the new release. |
| 32 | |
| 33 | FetchContent_GetProperties(mcuboot) |
| 34 | if(NOT mcuboot_POPULATED) |
| 35 | FetchContent_Populate(mcuboot) |
| 36 | set(MCUBOOT_PATH ${mcuboot_SOURCE_DIR} CACHE PATH "Path to MCUBOOT (or DOWNLOAD to get automatically" FORCE) |
| 37 | endif() |
| 38 | endif() |