mirror of
https://github.com/Z3Prover/z3
synced 2026-07-15 19:45:41 +00:00
`z3_add_install_tactic_rule` unconditionally called `file(WRITE)` during
CMake configure, updating `install_tactic.deps`'s mtime on every
reconfiguration — even when the content was identical. Since
`install_tactic.cpp` lists `install_tactic.deps` as a dependency, any
CMake reconfigure (e.g. touching `src/api/ml/CMakeLists.txt`) caused a
full rebuild of the tactic installation target.
## Change
- **`cmake/z3_add_component.cmake` — `z3_add_install_tactic_rule`**:
Replace unconditional `file(WRITE)` with a read-and-compare guard; the
deps file is only rewritten when its content actually changes.
```cmake
# Before
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/install_tactic.deps" ${_tactic_header_files})
# After
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()
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| modules | ||
| check_link_atomic.cmake | ||
| cmake_uninstall.cmake.in | ||
| compiler_lto.cmake | ||
| compiler_warnings.cmake | ||
| cxx_compiler_flags_overrides.cmake | ||
| git_utils.cmake | ||
| msvc_legacy_quirks.cmake | ||
| target_arch_detect.cmake | ||
| target_arch_detect.cpp | ||
| z3_add_component.cmake | ||
| z3_add_cxx_flag.cmake | ||
| z3_append_linker_flag_list_to_target.cmake | ||
| Z3Config.cmake.in | ||