From cb89dc69a49676d4b27456b56fa5216abfda80f2 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 23 Feb 2021 15:23:00 +0100
Subject: [PATCH] [CMake] Renamed BUILD_TESTING to OGS_BUILD_TESTING.

Does not interfere with CPM modules.
---
 Applications/Utils/CMakeLists.txt                          | 2 +-
 CMakeLists.txt                                             | 7 ++++---
 ProcessLib/ComponentTransport/CMakeLists.txt               | 2 +-
 ProcessLib/HT/CMakeLists.txt                               | 2 +-
 ProcessLib/HT/Tests.cmake                                  | 2 +-
 ProcessLib/HeatConduction/CMakeLists.txt                   | 2 +-
 ProcessLib/HeatTransportBHE/CMakeLists.txt                 | 2 +-
 ProcessLib/HydroMechanics/CMakeLists.txt                   | 2 +-
 ProcessLib/LIE/CMakeLists.txt                              | 2 +-
 ProcessLib/LiquidFlow/CMakeLists.txt                       | 2 +-
 ProcessLib/PhaseField/CMakeLists.txt                       | 2 +-
 ProcessLib/RichardsComponentTransport/CMakeLists.txt       | 2 +-
 ProcessLib/RichardsFlow/CMakeLists.txt                     | 2 +-
 ProcessLib/RichardsMechanics/CMakeLists.txt                | 2 +-
 ProcessLib/SmallDeformation/CMakeLists.txt                 | 2 +-
 ProcessLib/SmallDeformationNonlocal/CMakeLists.txt         | 2 +-
 ProcessLib/TES/CMakeLists.txt                              | 2 +-
 ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt        | 2 +-
 ProcessLib/ThermoHydroMechanics/CMakeLists.txt             | 2 +-
 ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt       | 2 +-
 ProcessLib/ThermoMechanics/CMakeLists.txt                  | 2 +-
 ProcessLib/ThermoRichardsMechanics/CMakeLists.txt          | 2 +-
 ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt               | 2 +-
 ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt             | 2 +-
 scripts/cmake/Dependencies.cmake                           | 2 +-
 scripts/cmake/PythonSetup.cmake                            | 2 +-
 scripts/cmake/test/MeshTest.cmake                          | 2 +-
 scripts/cmake/test/OgsTest.cmake                           | 2 +-
 .../docs/devguide/advanced/configuration-options.md        | 2 +-
 29 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/Applications/Utils/CMakeLists.txt b/Applications/Utils/CMakeLists.txt
index 5fb663ed1cc..7138ca6f6f6 100644
--- a/Applications/Utils/CMakeLists.txt
+++ b/Applications/Utils/CMakeLists.txt
@@ -14,6 +14,6 @@ if(OGS_BUILD_SWMM)
     add_subdirectory(SWMMConverter)
 endif()
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be9b0275d0a..dc1dea6cba3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,6 +73,7 @@ if(OGS_USE_PETSC)
 endif()
 option(OGS_USE_CVODE "Use the Sundials CVODE module?" OFF)
 option(OGS_BUILD_UTILS "Should the utilities programs be built?" ON)
+option(OGS_BUILD_TESTING "Should the tests be built?" ON)
 
 # ---- CMake includes ----
 include(GitSetup)
@@ -220,7 +221,7 @@ include(scripts/cmake/packaging/Pack.cmake)
 # ---- Subdirectories ----
 
 # xdmfdiff
-if(OGS_USE_XDMF AND BUILD_TESTING)
+if(OGS_USE_XDMF AND OGS_BUILD_TESTING)
     add_subdirectory(Tests/xdmfdiff)
 endif()
 
@@ -240,12 +241,12 @@ if(OGS_BUILD_PROCESS_ComponentTransport
     add_subdirectory(ChemistryLib)
 endif()
 
-if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR BUILD_TESTING)
+if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
     add_subdirectory(ParameterLib)
     add_subdirectory(MaterialLib)
     add_subdirectory(ProcessLib)
 endif()
-if(BUILD_TESTING AND NOT IS_SUBPROJECT)
+if(OGS_BUILD_TESTING AND NOT IS_SUBPROJECT)
     add_subdirectory(Tests)
 endif()
 
diff --git a/ProcessLib/ComponentTransport/CMakeLists.txt b/ProcessLib/ComponentTransport/CMakeLists.txt
index c7e0c319ca0..20f45f1a2f7 100644
--- a/ProcessLib/ComponentTransport/CMakeLists.txt
+++ b/ProcessLib/ComponentTransport/CMakeLists.txt
@@ -4,6 +4,6 @@ ogs_add_library(ComponentTransport ${SOURCES})
 
 target_link_libraries(ComponentTransport PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/HT/CMakeLists.txt b/ProcessLib/HT/CMakeLists.txt
index 336db9e775c..17f027f19da 100644
--- a/ProcessLib/HT/CMakeLists.txt
+++ b/ProcessLib/HT/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(HT ${SOURCES})
 target_link_libraries(HT PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/HT/Tests.cmake b/ProcessLib/HT/Tests.cmake
index 5a21ae3e7bc..a1d14b54c0b 100644
--- a/ProcessLib/HT/Tests.cmake
+++ b/ProcessLib/HT/Tests.cmake
@@ -449,7 +449,7 @@ AddTest(
     VIS ThermalConvection_ts_1_t_0.000000.vtu
 )
 
-if(NOT OGS_USE_MPI AND BUILD_TESTING AND Python3_FOUND)
+if(NOT OGS_USE_MPI AND OGS_BUILD_TESTING AND Python3_FOUND)
     add_custom_target(generate_invalid_project_files_ht
         ${Python3_EXECUTABLE}
         ${PROJECT_SOURCE_DIR}/ThirdParty/ogs6py/generateInvalidMediaForHT.py
diff --git a/ProcessLib/HeatConduction/CMakeLists.txt b/ProcessLib/HeatConduction/CMakeLists.txt
index eeaa0e16318..e5353ad4f3c 100644
--- a/ProcessLib/HeatConduction/CMakeLists.txt
+++ b/ProcessLib/HeatConduction/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(HeatConduction ${SOURCES})
 target_link_libraries(HeatConduction PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/HeatTransportBHE/CMakeLists.txt b/ProcessLib/HeatTransportBHE/CMakeLists.txt
index 493279c2246..746f01dcec3 100644
--- a/ProcessLib/HeatTransportBHE/CMakeLists.txt
+++ b/ProcessLib/HeatTransportBHE/CMakeLists.txt
@@ -13,6 +13,6 @@ target_link_libraries(HeatTransportBHE
     $<$<TARGET_EXISTS:pybind11::pybind11>:pybind11::pybind11>
 )
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/HydroMechanics/CMakeLists.txt b/ProcessLib/HydroMechanics/CMakeLists.txt
index 9b40804c791..31004690cbf 100644
--- a/ProcessLib/HydroMechanics/CMakeLists.txt
+++ b/ProcessLib/HydroMechanics/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(HydroMechanics ${SOURCES})
 target_link_libraries(HydroMechanics PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/LIE/CMakeLists.txt b/ProcessLib/LIE/CMakeLists.txt
index e30ed86926d..208129bcce7 100644
--- a/ProcessLib/LIE/CMakeLists.txt
+++ b/ProcessLib/LIE/CMakeLists.txt
@@ -7,7 +7,7 @@ append_source_files(SOURCES SmallDeformation/LocalAssembler)
 ogs_add_library(LIE ${SOURCES})
 target_link_libraries(LIE PUBLIC ProcessLib LIECommon PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(HydroMechanics/Tests.cmake)
     include(SmallDeformation/Tests.cmake)
 endif()
diff --git a/ProcessLib/LiquidFlow/CMakeLists.txt b/ProcessLib/LiquidFlow/CMakeLists.txt
index 7a451eb2e3f..b7cd839b28b 100644
--- a/ProcessLib/LiquidFlow/CMakeLists.txt
+++ b/ProcessLib/LiquidFlow/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(LiquidFlow ${SOURCES})
 target_link_libraries(LiquidFlow PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/PhaseField/CMakeLists.txt b/ProcessLib/PhaseField/CMakeLists.txt
index 761ce0cfac0..34e13ba4029 100644
--- a/ProcessLib/PhaseField/CMakeLists.txt
+++ b/ProcessLib/PhaseField/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(PhaseField ${SOURCES})
 target_link_libraries(PhaseField PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/RichardsComponentTransport/CMakeLists.txt b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
index 18b0d9b405f..39a464cd941 100644
--- a/ProcessLib/RichardsComponentTransport/CMakeLists.txt
+++ b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
@@ -5,6 +5,6 @@ target_link_libraries(RichardsComponentTransport
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/RichardsFlow/CMakeLists.txt b/ProcessLib/RichardsFlow/CMakeLists.txt
index 2e8665ebf02..40fd6bfe768 100644
--- a/ProcessLib/RichardsFlow/CMakeLists.txt
+++ b/ProcessLib/RichardsFlow/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(RichardsFlow ${SOURCES})
 target_link_libraries(RichardsFlow PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/RichardsMechanics/CMakeLists.txt b/ProcessLib/RichardsMechanics/CMakeLists.txt
index a7f5cedb2c2..3606d05c6e8 100644
--- a/ProcessLib/RichardsMechanics/CMakeLists.txt
+++ b/ProcessLib/RichardsMechanics/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(RichardsMechanics ${SOURCES})
 target_link_libraries(RichardsMechanics PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/SmallDeformation/CMakeLists.txt b/ProcessLib/SmallDeformation/CMakeLists.txt
index 7b0c2b5a300..166bdd2122a 100644
--- a/ProcessLib/SmallDeformation/CMakeLists.txt
+++ b/ProcessLib/SmallDeformation/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(SmallDeformation ${SOURCES})
 target_link_libraries(SmallDeformation PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/SmallDeformationNonlocal/CMakeLists.txt b/ProcessLib/SmallDeformationNonlocal/CMakeLists.txt
index 06929dfbfc8..a889eb32405 100644
--- a/ProcessLib/SmallDeformationNonlocal/CMakeLists.txt
+++ b/ProcessLib/SmallDeformationNonlocal/CMakeLists.txt
@@ -5,6 +5,6 @@ target_link_libraries(SmallDeformationNonlocal
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/TES/CMakeLists.txt b/ProcessLib/TES/CMakeLists.txt
index 7c10dc5c190..ac6d0d890a5 100644
--- a/ProcessLib/TES/CMakeLists.txt
+++ b/ProcessLib/TES/CMakeLists.txt
@@ -4,6 +4,6 @@ ogs_add_library(TES ${SOURCES})
 
 target_link_libraries(TES PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
index b799aebe185..1ce81cf428b 100644
--- a/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
@@ -9,6 +9,6 @@ target_link_libraries(ThermalTwoPhaseFlowWithPP
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/ThermoHydroMechanics/CMakeLists.txt b/ProcessLib/ThermoHydroMechanics/CMakeLists.txt
index deb6548d49c..e17771bb65e 100644
--- a/ProcessLib/ThermoHydroMechanics/CMakeLists.txt
+++ b/ProcessLib/ThermoHydroMechanics/CMakeLists.txt
@@ -5,6 +5,6 @@ target_link_libraries(ThermoHydroMechanics
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt b/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
index 79d48e9fa0c..18d54925590 100644
--- a/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
+++ b/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
@@ -5,6 +5,6 @@ target_link_libraries(ThermoMechanicalPhaseField
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/ThermoMechanics/CMakeLists.txt b/ProcessLib/ThermoMechanics/CMakeLists.txt
index 930baf6e1f5..b93baacd4fd 100644
--- a/ProcessLib/ThermoMechanics/CMakeLists.txt
+++ b/ProcessLib/ThermoMechanics/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(ThermoMechanics ${SOURCES})
 target_link_libraries(ThermoMechanics PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/ThermoRichardsMechanics/CMakeLists.txt b/ProcessLib/ThermoRichardsMechanics/CMakeLists.txt
index b7575274b49..a43e38bd48e 100644
--- a/ProcessLib/ThermoRichardsMechanics/CMakeLists.txt
+++ b/ProcessLib/ThermoRichardsMechanics/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(ThermoRichardsMechanics ${SOURCES})
 target_link_libraries(ThermoRichardsMechanics PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
index bde2ca3eac0..1ccb23a8a09 100644
--- a/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
+++ b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
@@ -3,6 +3,6 @@ get_source_files(SOURCES)
 ogs_add_library(TwoPhaseFlowWithPP ${SOURCES})
 target_link_libraries(TwoPhaseFlowWithPP PUBLIC ProcessLib PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
index ef858c780f1..211da79bcff 100644
--- a/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
+++ b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
@@ -5,6 +5,6 @@ target_link_libraries(TwoPhaseFlowWithPrho
                       PUBLIC ProcessLib
                       PRIVATE ParameterLib)
 
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     include(Tests.cmake)
 endif()
diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake
index 99b8f41ebff..d927738f572 100644
--- a/scripts/cmake/Dependencies.cmake
+++ b/scripts/cmake/Dependencies.cmake
@@ -1,4 +1,4 @@
-if(BUILD_TESTING)
+if(OGS_BUILD_TESTING)
     CPMAddPackage(
         NAME googletest
         GITHUB_REPOSITORY google/googletest
diff --git a/scripts/cmake/PythonSetup.cmake b/scripts/cmake/PythonSetup.cmake
index 9c681984790..499baf4d51a 100644
--- a/scripts/cmake/PythonSetup.cmake
+++ b/scripts/cmake/PythonSetup.cmake
@@ -43,7 +43,7 @@ set(LOCAL_VIRTUALENV_BIN_DIRS
 )
 
 if(POETRY)
-    if(BUILD_TESTING)
+    if(OGS_BUILD_TESTING)
         list(APPEND PYTHON_PACKAGES snakemake=${ogs.minimum_version.snakemake})
     endif()
     execute_process(COMMAND ${CMD_COMMAND} poetry add ${PYTHON_PACKAGES}
diff --git a/scripts/cmake/test/MeshTest.cmake b/scripts/cmake/test/MeshTest.cmake
index 0240f963dfa..e27040f8a2d 100644
--- a/scripts/cmake/test/MeshTest.cmake
+++ b/scripts/cmake/test/MeshTest.cmake
@@ -17,7 +17,7 @@
 # )
 
 function (MeshTest)
-    if(NOT BUILD_TESTING)
+    if(NOT OGS_BUILD_TESTING)
         return()
     endif()
     # parse arguments
diff --git a/scripts/cmake/test/OgsTest.cmake b/scripts/cmake/test/OgsTest.cmake
index bcf10c5181f..efc854e1698 100644
--- a/scripts/cmake/test/OgsTest.cmake
+++ b/scripts/cmake/test/OgsTest.cmake
@@ -1,6 +1,6 @@
 function (OgsTest)
 
-    if(NOT OGS_BUILD_CLI OR NOT BUILD_TESTING)
+    if(NOT OGS_BUILD_CLI OR NOT OGS_BUILD_TESTING)
         return()
     endif()
     set(options DISABLED)
diff --git a/web/content/docs/devguide/advanced/configuration-options.md b/web/content/docs/devguide/advanced/configuration-options.md
index 8b470fc2e95..317a5fb1cdf 100644
--- a/web/content/docs/devguide/advanced/configuration-options.md
+++ b/web/content/docs/devguide/advanced/configuration-options.md
@@ -19,7 +19,7 @@ CMake switches to enable / disable parts of OGS.
 
 - `OGS_BUILD_CLI` - Builds the simulator. *Defaults* to *ON*. If set to *OFF* all processes are also disabled.
 - `OGS_BUILD_GUI` - Builds the Data Explorer. *Defaults* to *OFF*.
-- `BUILD_TESTING` - Builds the test executables. *Defaults* to *ON*.
+- `OGS_BUILD_TESTING` - Builds the test executables. *Defaults* to *ON*.
 - `OGS_BUILD_UTILS` - Builds several utilities.
 - `OGS_NO_EXTERNAL_LIBS` - Disables all external optional dependencies.
 - `OGS_BUILD_PROCESS_X` - For enabling/disabling compilation of process `X`.
-- 
GitLab