From 0270c16133c4288979e85eb1dba53f7331a64415 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Tue, 26 Oct 2021 17:24:06 +0200
Subject: [PATCH] [cmake] Add include guards to all cmake files

---
 cmake/modules/AddGstatFileLinks.cmake | 2 ++
 cmake/modules/AddInputFileLinks.cmake | 2 ++
 cmake/modules/DumuxDoxygen.cmake      | 2 ++
 cmake/modules/DumuxTestMacros.cmake   | 1 +
 cmake/modules/FindGLPK.cmake          | 1 +
 cmake/modules/FindGmsh.cmake          | 1 +
 cmake/modules/FindGstat.cmake         | 1 +
 cmake/modules/FindNLOPT.cmake         | 1 +
 cmake/modules/FindPVPython.cmake      | 1 +
 9 files changed, 12 insertions(+)

diff --git a/cmake/modules/AddGstatFileLinks.cmake b/cmake/modules/AddGstatFileLinks.cmake
index f9ac2cfe2d..4ef1052da1 100644
--- a/cmake/modules/AddGstatFileLinks.cmake
+++ b/cmake/modules/AddGstatFileLinks.cmake
@@ -1,4 +1,6 @@
 # Creates symbolic links to all gstat files in the source directory
+include_guard(GLOBAL)
+
 macro(add_gstat_file_links)
   FILE(GLOB gstat_files gstat*.txt *.gstat)
   foreach(VAR ${gstat_files})
diff --git a/cmake/modules/AddInputFileLinks.cmake b/cmake/modules/AddInputFileLinks.cmake
index 9f2312c16b..a509342632 100644
--- a/cmake/modules/AddInputFileLinks.cmake
+++ b/cmake/modules/AddInputFileLinks.cmake
@@ -1,4 +1,6 @@
 # Creates symbolic links to all input files in the source directory
+include_guard(GLOBAL)
+
 macro(add_input_file_links)
   FILE(GLOB input_files *.input)
   foreach(VAR ${input_files})
diff --git a/cmake/modules/DumuxDoxygen.cmake b/cmake/modules/DumuxDoxygen.cmake
index f9d6be1813..cc4e734beb 100644
--- a/cmake/modules/DumuxDoxygen.cmake
+++ b/cmake/modules/DumuxDoxygen.cmake
@@ -1,6 +1,8 @@
 # add_dumux_doxgen_target
 #
 # make sure, that the doxygen links to todo list, bibliography, etc. are correct
+include_guard(GLOBAL)
+
 MACRO (add_dumux_doxygen_target)
   if(DOXYGEN_FOUND)
     add_doxygen_target()
diff --git a/cmake/modules/DumuxTestMacros.cmake b/cmake/modules/DumuxTestMacros.cmake
index b484dd5f82..e4b8cc77f5 100644
--- a/cmake/modules/DumuxTestMacros.cmake
+++ b/cmake/modules/DumuxTestMacros.cmake
@@ -199,6 +199,7 @@
 #       Example: Write CMAKE_GUARD dune-foo_FOUND if you want to set a variable
 #       that is only true if the module dune-foo has been found.
 #
+include_guard(GLOBAL)
 
 # Note: This forwards to dune_add_test but enables another layer in case we need to support
 # future Dune features with older Dune versions supported by Dumux
diff --git a/cmake/modules/FindGLPK.cmake b/cmake/modules/FindGLPK.cmake
index 7e1e38da14..9a7ef3f141 100644
--- a/cmake/modules/FindGLPK.cmake
+++ b/cmake/modules/FindGLPK.cmake
@@ -10,6 +10,7 @@
 # GLPK_INCLUDE_DIRS    Path to the GLPK include dirs.
 # GLPK_LIBRARIES       Name to the GLPK library.
 #
+include_guard(GLOBAL)
 
 # look for header files, only at positions given by the user
 find_path(GLPK_INCLUDE_DIR
diff --git a/cmake/modules/FindGmsh.cmake b/cmake/modules/FindGmsh.cmake
index 5fa395e0a4..0d0ac8c132 100644
--- a/cmake/modules/FindGmsh.cmake
+++ b/cmake/modules/FindGmsh.cmake
@@ -22,6 +22,7 @@
 #   for the gmsh library in the given path before inspecting
 #   system paths.
 #
+include_guard(GLOBAL)
 
 # look for header files, only at positions given by the user
 find_program(GMSH_EXECUTABLE
diff --git a/cmake/modules/FindGstat.cmake b/cmake/modules/FindGstat.cmake
index 8931f20a67..a55ce86883 100644
--- a/cmake/modules/FindGstat.cmake
+++ b/cmake/modules/FindGstat.cmake
@@ -22,6 +22,7 @@
 #   for the gstat library in the given path before inspecting
 #   system paths.
 #
+include_guard(GLOBAL)
 
 # look for header files, only at positions given by the user
 find_program(GSTAT_EXECUTABLE
diff --git a/cmake/modules/FindNLOPT.cmake b/cmake/modules/FindNLOPT.cmake
index 7163be70bb..39148f70fe 100644
--- a/cmake/modules/FindNLOPT.cmake
+++ b/cmake/modules/FindNLOPT.cmake
@@ -10,6 +10,7 @@
 # NLOPT_INCLUDE_DIRS    Path to the NLOPT include dirs.
 # NLOPT_LIBRARIES       Name to the NLOPT library.
 #
+include_guard(GLOBAL)
 
 # look for header files, only at positions given by the user
 find_path(NLOPT_INCLUDE_DIR
diff --git a/cmake/modules/FindPVPython.cmake b/cmake/modules/FindPVPython.cmake
index 1ed2751f02..a11941dacf 100644
--- a/cmake/modules/FindPVPython.cmake
+++ b/cmake/modules/FindPVPython.cmake
@@ -22,6 +22,7 @@
 #   for the pvpython library in the given path before inspecting
 #   system paths.
 #
+include_guard(GLOBAL)
 
 # look for header files, only at positions given by the user
 find_program(PVPYTHON_EXECUTABLE
-- 
GitLab