From 328c0375d0317b2afe94d2d7138480ec97ed9466 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 8 Feb 2021 20:48:36 +0100
Subject: [PATCH] Replaced spdlog submodule with CPM.

---
 .gitmodules                        | 3 ---
 CMakeLists.txt                     | 2 +-
 ThirdParty/CMakeLists.txt          | 3 ---
 ThirdParty/spdlog                  | 1 -
 scripts/cmake/Find.cmake           | 7 +++++++
 scripts/cmake/SubmoduleSetup.cmake | 1 -
 6 files changed, 8 insertions(+), 9 deletions(-)
 delete mode 160000 ThirdParty/spdlog

diff --git a/.gitmodules b/.gitmodules
index 3b307a1f168..7ea8d46e61d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -34,9 +34,6 @@
 [submodule "ThirdParty/json-cmake"]
 	path = ThirdParty/json-cmake
 	url = https://github.com/ufz/json-cmake.git
-[submodule "ThirdParty/spdlog"]
-	path = ThirdParty/spdlog
-	url = https://github.com/gabime/spdlog.git
 [submodule "ThirdParty/xdmf"]
 	path = ThirdParty/xdmf
 	url = https://gitlab.opengeosys.org/ogs/xdmflib.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa190f6a192..44c7796bc87 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,7 +225,7 @@ include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/tclap/include
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/json/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/include)
+)
 
 # vtkdiff
 if(BUILD_TESTING)
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index 7bbfabba045..8adf87ae71e 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -1,6 +1,3 @@
-add_subdirectory(spdlog)
-set(DISABLE_WARNINGS_TARGETS spdlog)
-
 # This is a workaround for Travis builds.
 option(OGS_USE_OPTIONAL_SUBMODULES "Option for enabling optional submodules" OFF)
 
diff --git a/ThirdParty/spdlog b/ThirdParty/spdlog
deleted file mode 160000
index de0dbfa3596..00000000000
--- a/ThirdParty/spdlog
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit de0dbfa3596a18cd70a4619b6a9766847a941276
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index b788ebd5614..7cd90c940eb 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -32,6 +32,13 @@ if(exprtk_ADDED)
     target_include_directories(exprtk INTERFACE ${exprtk_SOURCE_DIR})
 endif()
 
+CPMAddPackage(
+    NAME spdlog
+    GITHUB_REPOSITORY gabime/spdlog
+    VERSION 1.8.2
+    # DOWNLOAD_ONLY YES
+)
+
 ######################
 ### Find tools     ###
 ######################
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index bdd7f6a570a..1f0580bf2e7 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -12,7 +12,6 @@ set(REQUIRED_SUBMODULES
     ThirdParty/cmake-modules
     ThirdParty/iphreeqc/src
     ThirdParty/json-cmake
-    ThirdParty/spdlog
     ThirdParty/tclap
     ThirdParty/tetgen
     ${OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT}
-- 
GitLab