From 6d2087b40fb35d5a5b31938c0b300dde7b47126d Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 8 Feb 2021 22:06:40 +0100
Subject: [PATCH] Replaced json-cmake submodule with CPM.

---
 .gitmodules                        | 3 ---
 ThirdParty/json-cmake              | 1 -
 scripts/cmake/SubmoduleSetup.cmake | 1 -
 scripts/cmake/Versions.cmake       | 8 +++++++-
 4 files changed, 7 insertions(+), 6 deletions(-)
 delete mode 160000 ThirdParty/json-cmake

diff --git a/.gitmodules b/.gitmodules
index 70d8985ad43..f25f5e6b5ba 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -19,9 +19,6 @@
 [submodule "ThirdParty/ogs6py"]
 	path = ThirdParty/ogs6py
 	url = https://github.com/joergbuchwald/ogs6py.git
-[submodule "ThirdParty/json-cmake"]
-	path = ThirdParty/json-cmake
-	url = https://github.com/ufz/json-cmake.git
 [submodule "ThirdParty/xdmf"]
 	path = ThirdParty/xdmf
 	url = https://gitlab.opengeosys.org/ogs/xdmflib.git
diff --git a/ThirdParty/json-cmake b/ThirdParty/json-cmake
deleted file mode 160000
index 9708cb091f6..00000000000
--- a/ThirdParty/json-cmake
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9708cb091f6b89b94d71ae98f8b9e68ea04c47dd
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index 67cab62974e..64627def806 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -5,7 +5,6 @@ endif()
 # This file initializes the required submodules
 set(REQUIRED_SUBMODULES
     ThirdParty/iphreeqc/src
-    ThirdParty/json-cmake
 )
 if(OGS_USE_XDMF)
     list(APPEND REQUIRED_SUBMODULES ThirdParty/xdmf)
diff --git a/scripts/cmake/Versions.cmake b/scripts/cmake/Versions.cmake
index 7d9eed4199c..9993e3223df 100644
--- a/scripts/cmake/Versions.cmake
+++ b/scripts/cmake/Versions.cmake
@@ -1,4 +1,10 @@
-include(${PROJECT_SOURCE_DIR}/ThirdParty/json-cmake/JSONParser.cmake)
+CPMAddPackage(
+    NAME json-cmake
+    GITHUB_REPOSITORY ufz/json-cmake
+    GIT_TAG 9708cb091f6b89b94d71ae98f8b9e68ea04c47dd
+    DOWNLOAD_ONLY YES
+)
+include("${json-cmake_SOURCE_DIR}/JSONParser.cmake")
 file(READ ${PROJECT_SOURCE_DIR}/web/data/versions.json jsonFileString)
 sbeParseJson(ogs jsonFileString)
 # Provides variables, e.g. ogs.minimum_version.gcc
-- 
GitLab