From 4fab07f3b6ded084b84e4d3623b01182e549766f Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 22 Dec 2023 16:31:24 +0100
Subject: [PATCH] Fetch cmake modules at configure-time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Instead of using a submodule. See Scott (2023 k1077, § 39.6.2 "Sharing
CMake Modules And Commands"). The drawbacks are: the directory cmake
is duplicated in each build directory; configuration requires a
network connection. The advantages are: it is easier to download the
project without git; we can more easily package a release.
---
 .gitmodules    | 3 ---
 CMakeLists.txt | 6 +++++-
 cmake          | 1 -
 3 files changed, 5 insertions(+), 5 deletions(-)
 delete mode 160000 cmake

diff --git a/.gitmodules b/.gitmodules
index 592293e0..e69de29b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "cmake"]
-	path = cmake
-	url = https://github.com/lguez/cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b066ae80..e6e86567 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 3.20...3.27)
 project(Detection_eddies LANGUAGES Fortran)
 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release Profile
   RelWithDebInfo)
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
+include(FetchContent)
+FetchContent_Declare(LG_cmake_utils GIT_REPOSITORY
+  https://gitlab.in2p3.fr/guez/cmake.git GIT_TAG 517d97c3)
+FetchContent_MakeAvailable(LG_cmake_utils)
+list(APPEND CMAKE_MODULE_PATH "${lg_cmake_utils_SOURCE_DIR}")
 find_package(NetCDF_Fortran REQUIRED)
 find_package(MPI)
 
diff --git a/cmake b/cmake
deleted file mode 160000
index c49b86c3..00000000
--- a/cmake
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit c49b86c38a01ab90b665f41d0cc606f499157eae
-- 
GitLab