gnucash stable: Fix python tests on macOS by linking the right Python.

John Ralls jralls at code.gnucash.org
Thu Sep 25 15:46:56 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/e8673135 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a5a67525 (commit)



commit e86731358e51df09b02f898793a6d0e66ef15e37
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 25 12:46:43 2025 -0700

    Fix python tests on macOS by linking the right Python.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8e2a35bda..b9ed8093f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -216,6 +216,13 @@ if (WIN32)
   find_library(WS2_LIB ws2_32)
 endif()
 
+if (APPLE)
+  # Prefer libraries in the PREFIX over Apple-provided frameworks:
+  if (NOT DEFINED CMAKE_FIND_FRAMEWORK)
+    set(CMAKE_FIND_FRAMEWORK LAST)
+  endif()
+endif()
+
 find_package(Threads REQUIRED)
 find_package(PkgConfig REQUIRED)
 
@@ -529,6 +536,14 @@ if (WITH_PYTHON)
   if (NOT DEFINED Python3_FIND_UNVERSIONED_NAMES)
     set (Python3_FIND_UNVERSIONED_NAMES FIRST)
   endif()
+  if (NOT DEFINED Python3_FIND_VIRTUALENV)
+    # Don't prefer virtualenv python3: Prefer the one that's first on $PATH
+    set(Python3_FIND_VIRTUALENV STANDARD)
+  endif()
+  if (APPLE)
+    # The macOS SDK-provided Python framework lacks SQLite3 support
+    set(Python3_FIND_FRAMEWORK NEVER)
+  endif()
   find_package (Python3 ${PYTHON_MIN_VERSION} COMPONENTS Interpreter Development)
   if (NOT Python3_FOUND)
     message(SEND_ERROR "Python support enabled, but Python3 interpreter and/or libaries not found.")



Summary of changes:
 CMakeLists.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)



More information about the gnucash-changes mailing list