Skip to content
Snippets Groups Projects
Commit 4e92eeee authored by Lars Bilke's avatar Lars Bilke
Browse files

Added functionality for automatically initializing git submodules.

See scripts/cmake/SubmoduleSetup.cmake for details.
parent 2a6f15a0
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ INCLUDE(scripts/cmake/FindIncludeHeader.cmake) ...@@ -25,6 +25,7 @@ INCLUDE(scripts/cmake/FindIncludeHeader.cmake)
INCLUDE(scripts/cmake/Functions.cmake) INCLUDE(scripts/cmake/Functions.cmake)
INCLUDE(scripts/cmake/CMakeSetup.cmake) INCLUDE(scripts/cmake/CMakeSetup.cmake)
INCLUDE(scripts/cmake/CompilerSetup.cmake) INCLUDE(scripts/cmake/CompilerSetup.cmake)
INCLUDE(scripts/cmake/SubmoduleSetup.cmake)
IF(NOT OGS_NO_EXTERNAL_LIBS) IF(NOT OGS_NO_EXTERNAL_LIBS)
INCLUDE(scripts/cmake/Find.cmake) INCLUDE(scripts/cmake/Find.cmake)
ENDIF() # NOT OGS_NO_EXTERNAL_LIBS ENDIF() # NOT OGS_NO_EXTERNAL_LIBS
......
...@@ -7,8 +7,8 @@ ADD_LIBRARY(GeoLib STATIC ${SOURCES_GeoLib}) ...@@ -7,8 +7,8 @@ ADD_LIBRARY(GeoLib STATIC ${SOURCES_GeoLib})
include_directories( include_directories(
. .
../BaseLib ${CMAKE_SOURCE_DIR}/BaseLib
../MathLib ${CMAKE_SOURCE_DIR}/MathLib
) )
......
# Checks for unitialized git submodules
# Parameter 1: The path to the submodule
# Returns 0 if there is no such submodule
# Returns 1 if the module is already initialized
result=$(git submodule status $1 | grep '^-' | wc -l); exit $result
\ No newline at end of file
# This file initializes the required submodules
SET(REQUIRED_SUBMODULES
Tests/quickcheck
)
FOREACH(SUBMODULE ${REQUIRED_SUBMODULES})
# Check if submodule is already initialized
# MESSAGE(STATUS "Checking module ${SUBMODULE}")
EXECUTE_PROCESS(
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/cmake/SubmoduleCheck.sh ${SUBMODULE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE SUBMODULE_IS_NOT_INITIALIZED
)
IF(SUBMODULE_IS_NOT_INITIALIZED)
MESSAGE(STATUS "Initializing submodule ${SUBMODULE}")
EXECUTE_PROCESS(
COMMAND git submodule update --init ${SUBMODULE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ENDIF()
ENDFOREACH()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment