# ##############################################################################
# Init GIT submodules if they haven't already #
# ##############################################################################
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
foreach(SUBMODULE ${THIRD_PARTY_SUBMODULES})
set(SUBDIR "${PROJECT_SOURCE_DIR}/ThirdParty/${SUBMODULE}")
message(STATUS "Initializing GIT submodules")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --
${SUBDIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT
)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(
FATAL_ERROR
"git submodule update --init failed for ${SUBMODULE} with ${GIT_SUBMOD_RESULT}, please checkout submodules"
)
endif()
endforeach()
endif()
endif()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)