From 58db77cd0ac101195af747411450e13aef568cd3 Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Wed, 10 Feb 2021 12:33:42 -0500 Subject: [PATCH] revert to original recursive submodule approach --- CMakeLists.txt | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f21ddf6485..692f97b9c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,40 +144,27 @@ endif() # Update git submodules as needed #=============================================================================== -# Function that updates a git submodule, and double-checks that it exists -function(update_git_submodule git_submodule_name) - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init vendor/${git_submodule_name} - 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 with \ - ${GIT_SUBMOD_RESULT} on ${git_submodule_name}, please checkout submodules") - endif() - - # Double-check submodule indeed exists - if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/${git_submodule_name}/CMakeLists.txt") - message(FATAL_ERROR "The git submodule ${git_submodule_name} was not downloaded! GIT_SUBMODULE was \ - turned off or failed. Please update the ${git_submodule_name} submodule and try again.") - endif() -endfunction() - find_package(Git) if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") option(GIT_SUBMODULE "Check submodules during build" ON) if(GIT_SUBMODULE) message(STATUS "Submodule update") - if (NOT fmt_FOUND) - update_git_submodule(fmt) + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + 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 with \ + ${GIT_SUBMOD_RESULT}, please checkout submodules") endif() - if (NOT pugixml_FOUND) - update_git_submodule(pugixml) - endif() - update_git_submodule(gsl-lite) - update_git_submodule(xtensor) - update_git_submodule(xtl) endif() endif() +# Check to see if submodules exist (by checking one) +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/pugixml/CMakeLists.txt") + message(FATAL_ERROR "The git submodules were not downloaded! GIT_SUBMODULE was \ + turned off or failed. Please update submodules and try again.") +endif() + #=============================================================================== # pugixml library #===============================================================================