From 074b511fabf7aaf422b5c045600c5d116b78b82b Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <seth@kipro-pcb.com>
Date: Mon, 24 Mar 2025 14:07:23 -0700
Subject: [PATCH] Adjust OBJECT_DEPENDS for MacOS

It appears that MacOS only sees the last key/value for the
source_file_property whereas Linux/Windows see all depends.  This works
around the different by getting the value first, accumulating in the
loop and setting once at the end
---
 pcbnew/CMakeLists.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 40e6cf26a6..1b8fa6ed76 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -659,8 +659,14 @@ foreach(file ${markdownFiles})
     add_dependencies(generate_headers ${filename}_gen)
 
     # Mark the output header as a dependency of the source file
+    get_source_file_property(existing_depends dialogs/panel_setup_rules.cpp OBJECT_DEPENDS)
+    if(NOT existing_depends OR existing_depends STREQUAL "NOTFOUND")
+        set(existing_depends "")
+    else()
+        set(existing_depends "${existing_depends};")
+    endif()
     set_source_files_properties(dialogs/panel_setup_rules.cpp
-        PROPERTIES OBJECT_DEPENDS "${outputHeader}")
+        PROPERTIES OBJECT_DEPENDS "${existing_depends}${outputHeader}")
 endforeach()
 
 if( APPLE )