From 85e37dbb8822c1bff783969ab5b438b14712570f Mon Sep 17 00:00:00 2001 From: Shaopeng Ling Date: Wed, 21 Feb 2024 10:55:16 +0800 Subject: [PATCH] fix cmake submodule sync for third party dependencies (#61704) * fix cmake submodule sync for third party dependencies * fix sequential execution of multiple commands use execute_process * fix sequential execution of multiple commands on Windows platform --- cmake/third_party.cmake | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 7c086f780ab70..17c428660b223 100755 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -33,14 +33,25 @@ if(NOT WITH_SETUP_INSTALL) #NOTE(risemeup1):Initialize any submodules. message( STATUS - "Check submodules of paddle, and run 'git submodule update --init --recursive'" + "Check submodules of paddle, and run 'git submodule sync --recursive && git submodule update --init --recursive'" ) + + # execute_process does not support sequential commands, so we execute echo command separately + execute_process( + COMMAND git submodule sync --recursive + WORKING_DIRECTORY ${PADDLE_SOURCE_DIR} + RESULT_VARIABLE result_var) + if(NOT result_var EQUAL 0) + message(FATAL_ERROR "Failed to sync submodule, please check your network !") + endif() + execute_process( COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${PADDLE_SOURCE_DIR} RESULT_VARIABLE result_var) if(NOT result_var EQUAL 0) - message(FATAL_ERROR "Failed to get submodule, please check your network !") + message( + FATAL_ERROR "Failed to update submodule, please check your network !") endif() endif()