From b583731543e8ebe5290173f71ea708881365d200 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 8 Feb 2021 20:35:20 +0100
Subject: [PATCH] Replaced autocheck exprtk with CPM.

Submodule commit b0bc24cfdda39b30145b1f6c2c84b801cd131fef was not available anymore in the master branch of ArashPartow/exprtk.
The branch was maybe rebased? Used commit c7c219480d9678eec7383a4a99030683c4a84d91 instead (same commit date).
---
 .gitmodules                        |  3 ---
 CMakeLists.txt                     |  1 -
 ParameterLib/CMakeLists.txt        |  7 ++++---
 ThirdParty/exprtk                  |  1 -
 scripts/cmake/Find.cmake           | 11 +++++++++++
 scripts/cmake/SubmoduleSetup.cmake |  1 -
 6 files changed, 15 insertions(+), 9 deletions(-)
 delete mode 160000 ThirdParty/exprtk

diff --git a/.gitmodules b/.gitmodules
index cf30111f2fb..3b307a1f168 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -19,9 +19,6 @@
 [submodule "ThirdParty/pybind11"]
 	path = ThirdParty/pybind11
 	url = https://github.com/pybind/pybind11.git
-[submodule "ThirdParty/exprtk"]
-	path = ThirdParty/exprtk
-	url = https://github.com/ArashPartow/exprtk.git
 [submodule "ThirdParty/iphreeqc/src"]
 	path = ThirdParty/iphreeqc/src
 	url = https://github.com/ufz/iphreeqc.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f08928fa9dc..fa190f6a192 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,7 +225,6 @@ 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/exprtk
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/spdlog/include)
 
 # vtkdiff
diff --git a/ParameterLib/CMakeLists.txt b/ParameterLib/CMakeLists.txt
index de2dcb6bd4d..d2f0d3a1995 100644
--- a/ParameterLib/CMakeLists.txt
+++ b/ParameterLib/CMakeLists.txt
@@ -1,10 +1,11 @@
-# Source files
 get_source_files(SOURCES)
-
 ogs_add_library(ParameterLib ${SOURCES})
 
 include(GenerateExportHeader)
 generate_export_header(ParameterLib)
 target_include_directories(ParameterLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
 
-target_link_libraries(ParameterLib PUBLIC MathLib PRIVATE BaseLib MeshLib spdlog::spdlog)
+target_link_libraries(ParameterLib
+    PUBLIC MathLib
+    PRIVATE BaseLib exprtk MeshLib spdlog::spdlog
+)
diff --git a/ThirdParty/exprtk b/ThirdParty/exprtk
deleted file mode 160000
index d312ba91419..00000000000
--- a/ThirdParty/exprtk
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit d312ba91419c9cb12c8279fd3a19096d39dfcb5e
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index 8ca90b6259f..b788ebd5614 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -21,6 +21,17 @@ if(BUILD_TESTING)
     endif()
 endif()
 
+CPMAddPackage(
+    NAME exprtk
+    GITHUB_REPOSITORY ArashPartow/exprtk
+    GIT_TAG c7c219480d9678eec7383a4a99030683c4a84d91
+    DOWNLOAD_ONLY YES
+)
+if(exprtk_ADDED)
+    add_library(exprtk INTERFACE IMPORTED)
+    target_include_directories(exprtk INTERFACE ${exprtk_SOURCE_DIR})
+endif()
+
 ######################
 ### Find tools     ###
 ######################
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index bf11534fb1e..bdd7f6a570a 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -10,7 +10,6 @@ if(NOT OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT)
 endif()
 set(REQUIRED_SUBMODULES
     ThirdParty/cmake-modules
-    ThirdParty/exprtk
     ThirdParty/iphreeqc/src
     ThirdParty/json-cmake
     ThirdParty/spdlog
-- 
GitLab