diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-10-07 18:57:10 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-10-07 18:57:10 +0200 |
commit | e67cb38e5aa7374a83203ad888dbe5225d670b11 (patch) | |
tree | 3a017142c214835cc1c68652b58502292896f50f | |
parent | Merge pull request #4472 (diff) | |
parent | Add check if submodules need to be updated (diff) | |
download | monero-e67cb38e5aa7374a83203ad888dbe5225d670b11.tar.xz |
Merge pull request #4501
fb3593c2 Add check if submodules need to be updated (TheCharlatan)
-rw-r--r-- | CMakeLists.txt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 829a7e96c..ade7a290d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,6 +172,25 @@ else() message(STATUS "Building without build tag") endif() +if(NOT MANUAL_SUBMODULES) + find_package(Git) + if(GIT_FOUND) + message(STATUS "Checking submodules") + execute_process(COMMAND bash -c "cd ${CMAKE_CURRENT_SOURCE_DIR}/external/miniupnp && git rev-parse HEAD" OUTPUT_VARIABLE miniupnpLocalHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND bash -c "cd ${CMAKE_CURRENT_SOURCE_DIR}/external/unbound && git rev-parse HEAD" OUTPUT_VARIABLE unboundLocalHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND bash -c "cd ${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson && git rev-parse HEAD" OUTPUT_VARIABLE rapidjsonLocalHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND bash -c "git ls-tree HEAD ${CMAKE_CURRENT_SOURCE_DIR}/external/miniupnp | awk '{print $3}'" OUTPUT_VARIABLE miniupnpCheckedHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND bash -c "git ls-tree HEAD ${CMAKE_CURRENT_SOURCE_DIR}/external/unbound | awk '{print $3}'" OUTPUT_VARIABLE unboundCheckedHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process(COMMAND bash -c "git ls-tree HEAD ${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson | awk '{print $3}'" OUTPUT_VARIABLE rapidjsonCheckedHead WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + string(COMPARE EQUAL "${miniupnpLocalHead}" "${miniupnpCheckedHead}" miniupnpUpToDate) + string(COMPARE EQUAL "${unboundLocalHead}" "${unboundCheckedHead}" unboundUpToDate) + string(COMPARE EQUAL "${rapidjsonLocalHead}" "${rapidjsonCheckedHead}" rapidjsonUpToDate) + if (NOT miniupnpUpToDate OR NOT unboundUpToDate OR NOT rapidjsonUpToDate) + message(FATAL_ERROR "Submodules not up to date. Please update with git subdmoule init && git submodule update, or run cmake with -DMANUAL_SUBMODULES=1") + endif() + endif() +endif() + set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}") |