From 53a90ccb88c8282b4ad8d4d28c5a96dcdc81c4e5 Mon Sep 17 00:00:00 2001
From: Marek Roszko <mark.roszko@gmail.com>
Date: Mon, 13 Nov 2023 20:13:49 -0500
Subject: [PATCH] Enable macOS builds to run from build directory....

---
 CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b2bf4b2d6..7a9d115436 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -664,6 +664,11 @@ else()
     set( KICAD_DEMOS demos
         CACHE PATH "Location of KiCad demo files." FORCE )
 
+    # Required to run from build folder
+    if( PYTHON_FRAMEWORK )
+        list(APPEND CMAKE_BUILD_RPATH ${PYTHON_FRAMEWORK} )
+    endif()
+
     # RPATH settings for building shared libraries
     set( CMAKE_MACOSX_RPATH FALSE )
 endif()