[cmake] check if submodule dir is empty

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-08-02 15:25:12 -04:00
parent e7becc15b4
commit 3d178ec338

View file

@ -252,7 +252,10 @@ function(check_submodules_present)
string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules}) string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules})
foreach(module ${gitmodules}) foreach(module ${gitmodules})
string(REGEX REPLACE "path *= *" "" module ${module}) 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. " message(FATAL_ERROR "Git submodule ${module} not found. "
"Please run: \ngit submodule update --init --recursive") "Please run: \ngit submodule update --init --recursive")
endif() endif()