From 3d178ec3387774d5312cf861f2cb079a9856d88f Mon Sep 17 00:00:00 2001 From: crueter Date: Sat, 2 Aug 2025 15:25:12 -0400 Subject: [PATCH] [cmake] check if submodule dir is empty Signed-off-by: crueter --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f775cdf87b..c6feab7206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,7 +252,10 @@ function(check_submodules_present) string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules}) foreach(module ${gitmodules}) string(REGEX REPLACE "path *= *" "" module ${module}) - if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${module}/.git") + + file(GLOB RESULT "${PROJECT_SOURCE_DIR}/${module}/") + list(LENGTH RESULT RES_LEN) + if(RES_LEN EQUAL 0) message(FATAL_ERROR "Git submodule ${module} not found. " "Please run: \ngit submodule update --init --recursive") endif()