From 4dfc600776940627a632b51117933cba768fbbcf Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 28 Mar 2023 13:04:14 +0000
Subject: [PATCH] [cmake] Helper repo as a submodule.

---
 .gitmodules                    | 3 +++
 ThirdParty/collection          | 1 +
 scripts/cmake/CMakeSetup.cmake | 9 +++++----
 3 files changed, 9 insertions(+), 4 deletions(-)
 create mode 160000 ThirdParty/collection

diff --git a/.gitmodules b/.gitmodules
index 9b6b544e317..e95352252a2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
 [submodule "ThirdParty/bilke/cmake-modules"]
 	path = ThirdParty/bilke/cmake-modules
 	url = https://github.com/bilke/cmake-modules.git
+[submodule "ThirdParty/collection"]
+	path = ThirdParty/collection
+	url = https://gitlab.opengeosys.org/ogs/libs/collection.git
diff --git a/ThirdParty/collection b/ThirdParty/collection
new file mode 160000
index 00000000000..d1ab058c383
--- /dev/null
+++ b/ThirdParty/collection
@@ -0,0 +1 @@
+Subproject commit d1ab058c383e29c95e25f9a0a63c687a3ef27a39
diff --git a/scripts/cmake/CMakeSetup.cmake b/scripts/cmake/CMakeSetup.cmake
index b22f06c5a68..9b3a3840782 100644
--- a/scripts/cmake/CMakeSetup.cmake
+++ b/scripts/cmake/CMakeSetup.cmake
@@ -9,10 +9,11 @@ if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
     )
 endif()
 
-if(EXISTS "${OGS_HELPER_REPO}")
-    include(${OGS_HELPER_REPO}/Setup.cmake)
-elseif(DEFINED OGS_HELPER_REPO)
-    message(FATAL_ERROR "Helper repo at ${OGS_HELPER_REPO} not found!")
+set(_collection ${PROJECT_SOURCE_DIR}/ThirdParty/collection)
+# If submodules in ThirdParty/collection are initialized and is a Guix
+# build use submodule as CPM sources.
+if(EXISTS ${_collection}/ufz/vtkdiff/CMakeLists.txt AND GUIX_BUILD)
+    include(${_collection}/Setup.cmake)
 endif()
 
 # Set additional CMake modules path
-- 
GitLab