From 23bf464abb4f3d30333642601e51ec7fc2973878 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 2 Feb 2021 14:15:25 +0100
Subject: [PATCH] [CMake] Added option OGS_DISABLE_POETRY.

---
 CMakeLists.txt                  | 1 +
 scripts/cmake/PythonSetup.cmake | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8e1a62bcd2..229e4ae5e1f 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_DISABLE_POETRY "Disables automatic Python virtual environment handling with poetry." OFF)
 
 # Third-party libraries, names come from Conan package names
 set(OGS_LIBS
diff --git a/scripts/cmake/PythonSetup.cmake b/scripts/cmake/PythonSetup.cmake
index addc006022b..798a02648f0 100644
--- a/scripts/cmake/PythonSetup.cmake
+++ b/scripts/cmake/PythonSetup.cmake
@@ -1,4 +1,6 @@
-find_program(POETRY poetry)
+if(NOT OGS_DISABLE_POETRY)
+    find_program(POETRY poetry)
+endif()
 if(POETRY)
     configure_file(${PROJECT_SOURCE_DIR}/scripts/python/poetry.in.toml
         ${PROJECT_BINARY_DIR}/poetry.toml COPYONLY)
-- 
GitLab