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

[CMake] Made existence of local git repo optional.

This is used to minimize the Docker build context when building
an image with OGS inside from the local source tree.

Supply OGS_VERSION CMake variable.
parent a53e79f7
No related branches found
No related tags found
No related merge requests found
.git
Tests/Data
......@@ -16,7 +16,16 @@ execute_process(COMMAND ${GIT_EXECUTABLE} status
RESULT_VARIABLE IS_GIT_REPO
OUTPUT_QUIET)
if(IS_GIT_REPO GREATER 0)
message(FATAL_ERROR "Source code at ${PROJECT_SOURCE_DIR} is not a git "
"repository! Please use git to obtain the source code! See "
"https://www.opengeosys.org/docs/devguide/getting-started/get-the-source-code/")
set(IS_GIT_REPO FALSE CACHE INTERNAL "")
if(DEFINED OGS_VERSION)
message(WARNING "Using user-provided OGS_VERSION: ${OGS_VERSION}!")
message(WARNING "Submodule setup is skipped!")
else()
message(FATAL_ERROR "No git repository found at ${PROJECT_SOURCE_DIR}! "
"Please use git to obtain the source code! See "
"https://www.opengeosys.org/docs/devguide/getting-started/get-the-source-code/"
" OR manually set the OGS_VERSION variable.")
endif()
else()
set(IS_GIT_REPO TRUE CACHE INTERNAL "")
endif()
......@@ -28,6 +28,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MACOSX_RPATH 1)
if(NOT IS_GIT_REPO)
return()
endif()
# Get version info from Git, implementation based on
# https://github.com/tomtom-international/cpp-dependencies
execute_process(
......
if(NOT IS_GIT_REPO)
return()
endif()
# This file initializes the required submodules
set(OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT "" CACHE STRING
"User given submodules which should be checked out by CMake.")
......
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