From e05cf2e11ee58bec9457c201fa1cc72831137399 Mon Sep 17 00:00:00 2001 From: Harry Ramsey Date: Tue, 17 Sep 2024 15:12:11 +0100 Subject: [PATCH] Improve submodule error messages for Github archives This commit improves the error messages informing users that have downloaded Github archives to instead download a release archive. This is due to Github not supporting submodules within archives and no trivial way for users to use git to download them. Signed-off-by: Harry Ramsey --- CMakeLists.txt | 6 +++++- Makefile | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 561498c5d..958c24782 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -323,7 +323,11 @@ if(LIB_INSTALL_DIR) endif() if (NOT EXISTS "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt") - message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") + message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/.git/ not found. Please ensure you have downloaded a release version of Mbed TLS from GitHub.") + else () + message(FATAL_ERROR "${MBEDTLS_FRAMEWORK_DIR}/CMakeLists.txt not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.") + endif() endif() add_subdirectory(framework) diff --git a/Makefile b/Makefile index 71ef1bef0..07eb5567a 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,19 @@ $(MBEDTLS_PATH)/framework/exported.make not found. Run `git submodule update --init` to fetch the submodule contents. This is a fatal error endef + ifeq (,$(wildcard .git)) + define error_message +$(MBEDTLS_PATH)/.git/ not found. +Please ensure you have downloaded a release version of Mbed TLS from GitHub. +This is a fatal error + endef + else + define error_message +$(MBEDTLS_PATH)/framework/exported.make not found. +Run `git submodule update --init` to fetch the submodule contents. +This is a fatal error + endef + endif $(error $(error_message)) endif include framework/exported.make