From 9790cda4ead8bb746ead9d04e28c13e965f1963d Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Tue, 23 Jan 2024 13:53:37 +0100
Subject: [PATCH] Exclude CTests for TFEL build without python

Renaming internal variable to TFEL_WITH_PYTHON.
---
 CMakeLists.txt                                  |  7 +++----
 ProcessLib/SmallDeformation/Tests.cmake         |  4 +++-
 scripts/cmake/DependenciesExternalProject.cmake | 11 +++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 23189e3f712..d039d04be7e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,10 +236,9 @@ set(_envrc_content
     "[ -d \"${PROJECT_BINARY_DIR}/.venv\" ] && source ${PROJECT_BINARY_DIR}/.venv/bin/activate"
     "export PATH=$PATH:${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
 )
-if(_TFEL_SITE-PACKAGES_DIR)
-    set(_envrc_content
-        "${_envrc_content}"
-        "export PYTHONPATH=${_TFEL_SITE-PACKAGES_DIR}:$PYTHONPATH"
+if(TFEL_WITH_PYTHON)
+    set(_envrc_content "${_envrc_content}"
+                       "export PYTHONPATH=${TFEL_WITH_PYTHON}:$PYTHONPATH"
     )
 endif()
 string(REPLACE ";" "\n" _envrc_content "${_envrc_content}")
diff --git a/ProcessLib/SmallDeformation/Tests.cmake b/ProcessLib/SmallDeformation/Tests.cmake
index 3bfdfbff91a..df2c74da933 100644
--- a/ProcessLib/SmallDeformation/Tests.cmake
+++ b/ProcessLib/SmallDeformation/Tests.cmake
@@ -278,7 +278,9 @@ if(NOT OGS_USE_PETSC)
     endif()
     if (OGS_USE_MFRONT)
         NotebookTest(NOTEBOOKFILE Mechanics/PLLC/PLLC.ipynb RUNTIME 7)
-        NotebookTest(NOTEBOOKFILE Mechanics/HoekBrown/HoekBrownYieldCriterion.md RUNTIME 20)
+        if(TFEL_WITH_PYTHON)
+            NotebookTest(NOTEBOOKFILE Mechanics/HoekBrown/HoekBrownYieldCriterion.md RUNTIME 20)
+        endif()
     endif()
 endif()
 
diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake
index e017452b310..2bd66929a7e 100644
--- a/scripts/cmake/DependenciesExternalProject.cmake
+++ b/scripts/cmake/DependenciesExternalProject.cmake
@@ -106,17 +106,16 @@ if(OGS_USE_MFRONT)
                 "ExternalProject_Add(): added package TFEL@rliv-${ogs.minimum_version.tfel-rliv}"
         )
         if(Boost_${_py_boost_comp}_FOUND)
-            set(_TFEL_SITE-PACKAGES_DIR
+            set(TFEL_WITH_PYTHON
                 "${build_dir_TFEL}/lib/python${_py_version_major_minor}/site-packages"
-                CACHE INTERNAL ""
+                CACHE PATH ""
             )
         endif()
         set(TFELHOME ${build_dir_TFEL} CACHE PATH "" FORCE)
     endif()
-    if(_TFEL_SITE-PACKAGES_DIR)
-        message(
-            STATUS "TFEL build with Python bindings. To use them:\n "
-                   "  export PYTHONPATH=${_TFEL_SITE-PACKAGES_DIR}:$PYTHONPATH"
+    if(TFEL_WITH_PYTHON)
+        message(STATUS "TFEL build with Python bindings. To use them:\n "
+                       "  export PYTHONPATH=${TFEL_WITH_PYTHON}:$PYTHONPATH"
         )
     endif()
 endif()
-- 
GitLab