From 3e2247f5a0b67ba4931716fa34868e29c5e637c1 Mon Sep 17 00:00:00 2001 From: wowario Date: Sat, 9 Jun 2018 13:58:21 +0300 Subject: [PATCH] Add submodule init and update to cmake --- CMakeLists.txt | 9 +++++++++ README.md | 9 +++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b93988e2..627618b82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,15 @@ else() message(STATUS "Building without build tag") endif() +# Update and init submodules by default +if(NOT MANUAL_SUBMODULES) + find_package(Git) + if(GIT_FOUND) + message(STATUS "Initializing submodules") + execute_process(COMMAND git "submodule" "update" "--init" "--recursive" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + endif() +endif() + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}") diff --git a/README.md b/README.md index 5cb35b8f2..e3c50d1b0 100644 --- a/README.md +++ b/README.md @@ -135,13 +135,10 @@ build the library binary manually. This can be done with the following command ` ### Cloning the repository -Clone recursively to pull-in needed submodule(s): +`$ git clone https://github.com/wownero/wownero` -`$ git clone --recursive https://github.com/wownero/wownero` - -If you already have a repo cloned, initialize and update: - -`$ cd wownero && git submodule init && git submodule update` +Submodules are fetched and updated automatically. If you wish to +do this manually, run CMake flag `-DMANUAL_SUBMODULES=ON` to opt out. ### Build instructions