From eaf9236540e46688df3d014b7ade06edb085a9f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 13 Jul 2026 03:04:29 +0000 Subject: [PATCH] fix: only write install_tactic.deps when content changes to avoid unnecessary rebuilds --- cmake/z3_add_component.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cmake/z3_add_component.cmake b/cmake/z3_add_component.cmake index 962b02f684..e3dc2dd80c 100644 --- a/cmake/z3_add_component.cmake +++ b/cmake/z3_add_component.cmake @@ -273,7 +273,19 @@ macro(z3_add_install_tactic_rule) unset(_component_tactic_header_files) string(REPLACE ";" "\n" _tactic_header_files "${_tactic_header_files}") - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/install_tactic.deps" ${_tactic_header_files}) + # Only write the deps file if content has changed to avoid unnecessary rebuilds + # (file(WRITE) always updates the timestamp even if content is unchanged) + set(_install_tactic_deps_file "${CMAKE_CURRENT_BINARY_DIR}/install_tactic.deps") + if (EXISTS "${_install_tactic_deps_file}") + file(READ "${_install_tactic_deps_file}" _install_tactic_deps_old) + else() + set(_install_tactic_deps_old "") + endif() + if (NOT _install_tactic_deps_old STREQUAL "${_tactic_header_files}") + file(WRITE "${_install_tactic_deps_file}" "${_tactic_header_files}") + endif() + unset(_install_tactic_deps_old) + unset(_install_tactic_deps_file) add_custom_command(OUTPUT "install_tactic.cpp" COMMAND "${Python3_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/mk_install_tactic_cpp.py"