From 9cbade596f1168dcd45d631c893b373685b6a184 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 3 Feb 2021 11:04:28 +0100
Subject: [PATCH] [CMake] Set OGS_USE_PYTHON to ON per default.

---
 CMakeLists.txt                   | 6 ++----
 scripts/ci/jobs/check-header.yml | 2 +-
 scripts/ci/jobs/container.yml    | 2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdee39aef2d..d824930b0e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,7 @@ endif()
 if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
     option(OGS_USE_UNITY_BUILDS "Enables Unity builds for faster compilation." ON)
 endif()
+option(OGS_USE_PYTHON "Interface with Python" ON)
 option(OGS_DISABLE_POETRY "Disables automatic Python virtual environment handling with poetry." OFF)
 
 # Third-party libraries, names come from Conan package names
@@ -183,10 +184,7 @@ endif()
 option(OGS_CHECK_HEADER_COMPILATION "Check header for standalone compilation."
        OFF)
 
-option(OGS_USE_PYTHON "Interface with Python" OFF)
-if(OGS_USE_PYTHON AND NOT Python3_FOUND)
-    message(FATAL_ERROR "Python not found but required for OGS_USE_PYTHON=ON!")
-endif()
+option(OGS_USE_PYTHON "Interface with Python" ${Python3_FOUND})
 
 option(OGS_USE_MFRONT
        "Enable solid material models by MFront (https://tfel.sourceforge.net)"
diff --git a/scripts/ci/jobs/check-header.yml b/scripts/ci/jobs/check-header.yml
index 5fcbb618ce1..daf3914f27b 100644
--- a/scripts/ci/jobs/check-header.yml
+++ b/scripts/ci/jobs/check-header.yml
@@ -6,7 +6,7 @@ check header:
   dependencies: [meta, meta_container]
   variables:
     BUILD_DIR: "build-check-header"
-    CMAKE_ARGS: "-DOGS_CHECK_HEADER_COMPILATION=ON -DOGS_BUILD_GUI=ON -DOGS_USE_PYTHON=ON -DBUILD_SHARED_LIBS=ON"
+    CMAKE_ARGS: "-DOGS_CHECK_HEADER_COMPILATION=ON -DOGS_BUILD_GUI=ON -DBUILD_SHARED_LIBS=ON"
   image: $CONTAINER_GCC_GUI_IMAGE
   script:
     - mkdir -p $BUILD_DIR
diff --git a/scripts/ci/jobs/container.yml b/scripts/ci/jobs/container.yml
index 3d2465d5bcd..0ee94ee64f7 100644
--- a/scripts/ci/jobs/container.yml
+++ b/scripts/ci/jobs/container.yml
@@ -20,7 +20,7 @@ container:
       poetry run ogscm compiler.py ogs.py -B -C -R --ogs ../..
       --build_args ' --progress=plain'
       --pm system --cvode --ccache
-      --cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DBUILD_TESTING=OFF -DOGS_BUILD_UTILS=ON -DOGS_USE_PYTHON=ON'
+      --cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DBUILD_TESTING=OFF'
       $DOCKER_TAG
     - >
       poetry run ogscm compiler.py mpi.py ogs.py -B -C -R --ogs ../..
-- 
GitLab