From 9d054627152314c748b59611714b8641b3951db2 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 26 Aug 2020 02:52:36 +0200 Subject: [PATCH] cmake: fix DEV_MODE, checkout master in submodule --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b783fb05..e8129547 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,12 @@ if(GIT_FOUND) message(STATUS "Checking submodules") check_submodule(monero) else() - execute_process(COMMAND cd monero && git checkout origin/master) + execute_process(COMMAND ${GIT_EXECUTABLE} fetch WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_FETCH_RESULT) + execute_process(COMMAND ${GIT_EXECUTABLE} checkout -f origin/master WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_CHECKOUT_MASTER_RESULT) + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --force --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/monero RESULT_VARIABLE GIT_SUBMODULE_UPDATE_RESULT) + if(NOT GIT_FETCH_RESULT EQUAL "0" OR NOT GIT_CHECKOUT_MASTER_RESULT EQUAL "0" OR NOT GIT_SUBMODULE_UPDATE_RESULT EQUAL "0") + message(FATAL_ERROR "Updating git submodule to master (-DDEV_MODE=ON) failed") + endif() endif() endif()