[cmake] submodules: only add to CPMUtil if git exists

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-08-12 21:41:06 -04:00 committed by crueter
parent 15ba975916
commit 84818e9865
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6

View file

@ -268,7 +268,7 @@ function(check_submodules_present)
message(FATAL_ERROR "Git submodule ${module} not found. "
"Please run: \ngit submodule update --init --recursive")
endif()
if (EXISTS "${PROJECT_SOURCE_DIR}/${module}/.git")
set(SUBMODULE_DIR "${PROJECT_SOURCE_DIR}/${module}")
execute_process(
@ -292,6 +292,7 @@ function(check_submodules_present)
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_NAMES ${SUBMODULE_NAME})
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_SHAS ${SUBMODULE_SHA})
set_property(GLOBAL APPEND PROPERTY CPM_PACKAGE_URLS ${SUBMODULE_URL})
endif()
endforeach()
endfunction()