Merge pull request #6738 from 67hz/issue-tbd-rel-6710-cmake-gtest-submodule

Update git submodules during build
This commit is contained in:
Jnewbon 2020-07-29 10:31:52 +01:00 committed by GitHub
commit a7e51d5986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View file

@ -56,8 +56,10 @@ else()
set (SYNERGY_ADD_HEADERS TRUE)
endif()
set (libs)
include_directories (BEFORE SYSTEM ./ext/googletest/googletest/include)
include_directories (BEFORE SYSTEM ${PROJECT_SOURCE_DIR}/ext/googletest/googletest/include)
if (UNIX)
if (NOT APPLE)
@ -312,6 +314,32 @@ else()
message (FATAL_ERROR "Couldn't find OpenSSL")
endif()
#
# Check submodules
#
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
#
# Google Test
#
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/ext/googletest/CMakeLists.txt")
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
#
# Configure_file... but for directories, recursively.
#

View file

@ -8,6 +8,9 @@ Bug fixes:
- #6730 Updating synergy looses settings
- #6734 Fixed naming of installers for linux and windows
Enhancements:
- #6739 Add submodules cloning to cmake
v1.12.0-rc1
===========