Update git submodules during build
Making submodule init/update transparent to the end user. This change prevents CMake builds from failing if submodules have not been installed, e.g., Google Test.
This commit is contained in:
parent
28d376e7f0
commit
645ecc43e4
1 changed files with 29 additions and 1 deletions
|
|
@ -56,8 +56,10 @@ else()
|
||||||
set (SYNERGY_ADD_HEADERS TRUE)
|
set (SYNERGY_ADD_HEADERS TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set (libs)
|
set (libs)
|
||||||
include_directories (BEFORE SYSTEM ./ext/googletest/googletest/include)
|
include_directories (BEFORE SYSTEM ${PROJECT_SOURCE_DIR}/ext/googletest/googletest/include)
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
|
|
@ -312,6 +314,32 @@ else()
|
||||||
message (FATAL_ERROR "Couldn't find OpenSSL")
|
message (FATAL_ERROR "Couldn't find OpenSSL")
|
||||||
endif()
|
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.
|
# Configure_file... but for directories, recursively.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue