blob: 03f888e9e5ce655cf6144f366bc4fc4b551d9e46 [file] [log] [blame]
Raef Coles19715382020-07-10 09:50:17 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8include(FetchContent)
9set(FETCHCONTENT_QUIET FALSE)
10
Øyvind Rønningstadc72d9552020-10-30 21:29:40 +010011# Set to not download submodules if that option is available.
12# Because of https://gitlab.kitware.com/cmake/cmake/-/issues/20579 CMP0097 is
13# non-functional until cmake 3.18.0.
14if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0")
Raef Coles19715382020-07-10 09:50:17 +010015 cmake_policy(SET CMP0097 NEW)
Øyvind Rønningstadc72d9552020-10-30 21:29:40 +010016 set(MCUBOOT_SUBMODULES "")
17else()
18 # Workaround for not having CMP0097. Fetch the smallest submodule.
19 set(MCUBOOT_SUBMODULES "boot/cypress/libs/cy-mbedtls-acceleration/")
Raef Coles19715382020-07-10 09:50:17 +010020endif()
21
22if ("${MCUBOOT_PATH}" STREQUAL "DOWNLOAD")
23 FetchContent_Declare(mcuboot
Tamas Banc5b2f2b2020-11-12 09:47:05 +000024 GIT_REPOSITORY https://github.com/mcu-tools/mcuboot.git
Tamas Ban63f87ca2020-09-21 10:41:51 +010025 GIT_TAG ${MCUBOOT_VERSION}
Tamas Ban4b2d5a22020-09-16 13:15:43 +010026 GIT_SHALLOW FALSE
Raef Coles19715382020-07-10 09:50:17 +010027 GIT_PROGRESS TRUE
Anton Komlevc59de1a2021-11-11 12:04:37 +000028 GIT_SUBMODULES "${MCUBOOT_SUBMODULES}"
Raef Coles19715382020-07-10 09:50:17 +010029 )
Tamas Ban4b2d5a22020-09-16 13:15:43 +010030 # 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.
Raef Coles19715382020-07-10 09:50:17 +010032
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()
38endif()