From 537ff20a50fa661ac1bc752ff30e966c80a9846e Mon Sep 17 00:00:00 2001
From: Vladimir Onoprienko <vonopr@yandex.ru>
Date: Mon, 18 Apr 2022 17:04:02 +0300
Subject: [PATCH] Add cmake cache variables to configure remote deps
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The main reason of this change is to place URLs and Git Tags of remote
dependencies at the top of CMakeLists.txt

Another outсome is that the user will be able to adjust these settings
easily.
---
 CMakeLists.txt | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d1f423..2361e13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,13 +3,23 @@ project(exple_cmake_build CXX)
 
 option(DOWNLOAD_DEPS "Enable automatic download of dependencies" ON)
 
+set(COMMON_LIB_URL "http://tesla.parallel.ru/vonopr/explelibx-common.git"
+  CACHE STRING "Git repository URL of the downloaded 'explelibx-common' dependency; used if DOWNLOAD_DEPS enabled")
+set(COMMON_LIB_TAG "e45b60782a6414125c7300d9b7a77d34a8404d6e"
+  CACHE STRING "Specify the branch name, tag name or commit hash of the downloaded 'explelibx-common' dependency; used if DOWNLOAD_DEPS enabled")
+
+set(GRID_LIB_URL "http://tesla.parallel.ru/vonopr/explelibx-mgrid.git"
+  CACHE STRING "Git repository URL of the downloaded 'explelibx-mgrid' dependency; used if DOWNLOAD_DEPS enabled")
+set(GRID_LIB_TAG "c345859b9ebca2227e3b3faea4cc2380fdbb054f"
+  CACHE STRING "Specify the branch name, tag name or commit hash of the downloaded 'explelibx-mgrid' dependency; used if DOWNLOAD_DEPS enabled")
+
 # download dependency 'explelibx_common' or find it locally
 if (DOWNLOAD_DEPS)
   include(FetchContent)
   FetchContent_Declare(
     explelibx_common
-    GIT_REPOSITORY http://tesla.parallel.ru/vonopr/explelibx-common.git
-    GIT_TAG e45b60782a6414125c7300d9b7a77d34a8404d6e)
+    GIT_REPOSITORY "${COMMON_LIB_URL}"
+    GIT_TAG "${COMMON_LIB_TAG}")
   FetchContent_MakeAvailable(explelibx_common)
   set(COMMON_DIR "${explelibx_common_SOURCE_DIR}")
 else()
@@ -29,8 +39,8 @@ if (DOWNLOAD_DEPS)
   include(FetchContent)
   FetchContent_Declare(
     explelibx_mgrid
-    GIT_REPOSITORY http://tesla.parallel.ru/vonopr/explelibx-mgrid.git
-    GIT_TAG c345859b9ebca2227e3b3faea4cc2380fdbb054f)
+    GIT_REPOSITORY "${GRID_LIB_URL}"
+    GIT_TAG "${GRID_LIB_TAG}")
   FetchContent_MakeAvailable(explelibx_mgrid)
   set(GRID_DIR "${explelibx_mgrid_SOURCE_DIR}")
 else()
-- 
GitLab