mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
acaac7c233
It is possible that a .git directory isn't definitive on the existance of a working git tree. A git worktree over sshfs for instance will fail to build unless the main repository also exists in the same directory. Adding this extra test will make the detection that little more ruggardised for these odd build environments. Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
31 lines
1.4 KiB
CMake
31 lines
1.4 KiB
CMake
# 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
|
|
RESULT_VARIABLE git_config_get_result)
|
|
IF(git_config_get_result EQUAL 128 OR 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()
|