Boot: Add workaround to not fetch MCUboot's submodules
CMP0097 doesn't work on 3.16 and 3.17.
https://gitlab.kitware.com/cmake/cmake/-/issues/20579
Add a workaround (request the smallest submodule).
This prevents fetching almost 200 MB of data, improving
pristine build times.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Change-Id: Ia46e6de6e43a28bffac0c3904dfbb4fde92df96e
diff --git a/lib/ext/mcuboot/CMakeLists.txt b/lib/ext/mcuboot/CMakeLists.txt
index d26d20c..a37b1e4 100644
--- a/lib/ext/mcuboot/CMakeLists.txt
+++ b/lib/ext/mcuboot/CMakeLists.txt
@@ -8,9 +8,15 @@
include(FetchContent)
set(FETCHCONTENT_QUIET FALSE)
-# Set to not download submodules if that option is available
-if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
+# Set to not download submodules if that option is available.
+# Because of https://gitlab.kitware.com/cmake/cmake/-/issues/20579 CMP0097 is
+# non-functional until cmake 3.18.0.
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18.0")
cmake_policy(SET CMP0097 NEW)
+ set(MCUBOOT_SUBMODULES "")
+else()
+ # Workaround for not having CMP0097. Fetch the smallest submodule.
+ set(MCUBOOT_SUBMODULES "boot/cypress/libs/cy-mbedtls-acceleration/")
endif()
if ("${MCUBOOT_PATH}" STREQUAL "DOWNLOAD")
@@ -19,7 +25,7 @@
GIT_TAG ${MCUBOOT_VERSION}
GIT_SHALLOW FALSE
GIT_PROGRESS TRUE
- GIT_SUBMODULES ""
+ GIT_SUBMODULES ${MCUBOOT_SUBMODULES}
)
# ToDo: set GIT_SHALLOW to 'TRUE' when MCUBOOT_VERSION will be set to a tag
# (instead of a commit hash) with the new release.