Input_file_list avoid unneeded rebuild patch

diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake
index 0beca97342..2ffc8b76f7 100644
--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -433,7 +433,16 @@ function(juce_add_binary_data target)
     endforeach()
 
     set(input_file_list "${juce_binary_data_folder}/input_file_list")
-    file(WRITE "${input_file_list}" "${newline_delimited_input}")
+
+    if(EXISTS "${input_file_list}")
+        file(READ "${input_file_list}" old_content)
+    else()
+        set(old_content "")
+    endif()
+
+    if(NOT "${old_content}" STREQUAL "${newline_delimited_input}")
+        file(WRITE "${input_file_list}" "${newline_delimited_input}")
+    endif()
 
     add_custom_command(OUTPUT ${binary_file_names}

This will stop running cmake configure step from rebuilding binary data every time unnecessarily (with Ninja)

Not checked to see if you’ve already done this in JUCE 8 yet, this is a patch against the JUCE 7 JUCEUtils.cmake but I’m guessing it won’t have changed.

This still rebuilds the binary data files if the source data/timestampes have changed, I tested it.

Thanks, this looks sensible, added here:

1 Like