diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-07-10 15:06:41 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-08-14 19:45:58 +0200 |
commit | c9db190fed4e368201703e3d1031e16abfd61e45 (patch) | |
tree | 1f8c6449e94957bb13bd62582368bdadd4c9b4af /cmake | |
parent | bfa9990e333136ef205f8761785dacedb1eb7b35 (diff) | |
download | mariadb-git-c9db190fed4e368201703e3d1031e16abfd61e45.tar.gz |
cmake: update submodules automatically during the build
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/mariadb_connector_c.cmake | 14 | ||||
-rw-r--r-- | cmake/submodules.cmake | 30 |
2 files changed, 30 insertions, 14 deletions
diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index 400fcda0c1a..6773314313b 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -1,17 +1,3 @@ -IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt AND GIT_EXECUTABLE) - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule init - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") -ENDIF() -IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt) - MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run - git submodule init - git submodule update -Then restart the build. -") -ENDIF() - SET(OPT CONC_) IF (CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake new file mode 100644 index 00000000000..61eacba7c73 --- /dev/null +++ b/cmake/submodules.cmake @@ -0,0 +1,30 @@ +# update submodules automatically +IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" config --get cmake.update-submodules + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE cmake_update_submodules) + IF(cmake_update_submodules MATCHES no) + SET(update_result 0) + ELSEIF (cmake_update_submodules MATCHES force) + MESSAGE("-- Updating submodules (forced)") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSEIF (cmake_update_submodules MATCHES yes) + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSE() + MESSAGE("-- Updating submodules") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ENDIF() +ENDIF() + +IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt) + MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run + git submodule update --init +Then restart the build. +") +ENDIF() |