From 8da9646d17cf2116fe6dd979fe71c49921e4089b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carsten=20Gr=C3=A4ser?= <graeser@math.fau.de>
Date: Tue, 25 Feb 2025 09:17:59 +0100
Subject: [PATCH] [cmake] Do not add python flags unconditionally

This add a patch from https://gitlab.dune-project.org/fufem/dune-fufem/-/merge_requests/239
and also removes some 2.7 backward compatibility code, since we only
support dune versions >= 2.9 which all require Python3.
---
 cmake/modules/AddPythonLibsFlags.cmake | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/cmake/modules/AddPythonLibsFlags.cmake b/cmake/modules/AddPythonLibsFlags.cmake
index c114f1ec..da4a1bca 100644
--- a/cmake/modules/AddPythonLibsFlags.cmake
+++ b/cmake/modules/AddPythonLibsFlags.cmake
@@ -13,12 +13,8 @@ function(add_dune_pythonlibs_flags _targets)
         if(Python3_FOUND)
             target_link_libraries(${_target} PUBLIC ${Python3_LIBRARIES})
             set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Python3_INCLUDE_DIRS})
-        # backward compatibility with 2.7 core tests
-        elseif(PYTHONLIBS_FOUND)
-            target_link_libraries(${_target} PUBLIC ${PYTHON_LIBRARIES})
-            set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
-        endif()
             set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS "HAVE_PYTHON")
             set_property(TARGET ${_target} APPEND PROPERTY COMPILE_OPTIONS "-fno-strict-aliasing")
+        endif()
     endforeach(_target ${_targets})
 endfunction(add_dune_pythonlibs_flags)
-- 
GitLab