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

---
 .gitmodules                        |  3 ---
 CMakeLists.txt                     |  1 -
 Tests/CMakeLists.txt               |  1 +
 ThirdParty/autocheck               |  1 -
 scripts/cmake/Find.cmake           | 10 ++++++++++
 scripts/cmake/SubmoduleSetup.cmake |  1 -
 6 files changed, 11 insertions(+), 6 deletions(-)
 delete mode 160000 ThirdParty/autocheck

diff --git a/.gitmodules b/.gitmodules
index 56e05dc20ec..cf30111f2fb 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,9 +7,6 @@
 [submodule "ThirdParty/tclap"]
 	path = ThirdParty/tclap
 	url = https://github.com/ufz/tclap.git
-[submodule "ThirdParty/autocheck"]
-	path = ThirdParty/autocheck
-	url = https://github.com/ufz/autocheck.git
 [submodule "ThirdParty/metis"]
 	path = ThirdParty/metis
 	url = https://github.com/scibuilder/metis.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a709f2ecba6..f08928fa9dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,7 +223,6 @@ add_subdirectory(ThirdParty)
 include_directories(
     SYSTEM
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty
-    ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/autocheck/include
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/tclap/include
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/json/include
     ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/exprtk
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 23f0e8f5526..8418493cc3e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -57,6 +57,7 @@ set_target_properties(testrunner PROPERTIES FOLDER Testing)
 target_link_libraries(testrunner
     PRIVATE
         ApplicationsFileIO
+        autocheck
         gtest
         MeshGeoToolsLib
         MaterialLib
diff --git a/ThirdParty/autocheck b/ThirdParty/autocheck
deleted file mode 160000
index e388ecbb31c..00000000000
--- a/ThirdParty/autocheck
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e388ecbb31c49fc2724c8d0436da313b6edca7fd
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index 0adb99f7c6d..8ca90b6259f 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -9,6 +9,16 @@ if(BUILD_TESTING)
             "INSTALL_GTEST OFF"
             "gtest_force_shared_crt ON"
     )
+    CPMAddPackage(
+        NAME autocheck
+        GITHUB_REPOSITORY ufz/autocheck
+        GIT_TAG e388ecbb31c49fc2724c8d0436da313b6edca7fd
+        DOWNLOAD_ONLY YES
+    )
+    if(autocheck_ADDED)
+        add_library(autocheck INTERFACE IMPORTED)
+        target_include_directories(autocheck INTERFACE ${autocheck_SOURCE_DIR}/include)
+    endif()
 endif()
 
 ######################
diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake
index 17e1c19d44f..bf11534fb1e 100644
--- a/scripts/cmake/SubmoduleSetup.cmake
+++ b/scripts/cmake/SubmoduleSetup.cmake
@@ -9,7 +9,6 @@ if(NOT OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT)
     set(OGS_ADDITIONAL_SUBMODULES_TO_CHECKOUT "")
 endif()
 set(REQUIRED_SUBMODULES
-    ThirdParty/autocheck
     ThirdParty/cmake-modules
     ThirdParty/exprtk
     ThirdParty/iphreeqc/src
-- 
GitLab