3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 03:25:43 +00:00
z3/cmake
Copilot 136a653ade
cmake: prevent install_tactic.deps from triggering spurious rebuilds on reconfigure (#10102)
`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>
2026-07-12 20:07:41 -07:00
..
modules Bump dotnet example target framework from netcoreapp2.0 to net8.0 (#9531) 2026-05-14 15:17:41 -07:00
check_link_atomic.cmake cmake: skip std::atomic link check for Emscripten and single-threaded builds (#9932) 2026-06-23 14:05:02 -06:00
cmake_uninstall.cmake.in [CMake] Move CMake files into their intended location so the 2017-06-12 11:59:00 +01:00
compiler_lto.cmake clean up CMake code (#5182) 2021-04-14 10:29:15 -07:00
compiler_warnings.cmake Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
cxx_compiler_flags_overrides.cmake [CMake] Move CMake files into their intended location so the 2017-06-12 11:59:00 +01:00
git_utils.cmake Use '--tags' rather than '--long' for git describe. Closes #6823 (#7833) 2025-08-29 14:15:38 -07:00
msvc_legacy_quirks.cmake clean up CMake code (#5182) 2021-04-14 10:29:15 -07:00
target_arch_detect.cmake Change from BINARY_DIR to PROJECT_BINARY_DIR 2019-05-15 11:25:40 -07:00
target_arch_detect.cpp set ARM64 if detected under OSX 2022-04-07 08:35:56 +02:00
z3_add_component.cmake cmake: prevent install_tactic.deps from triggering spurious rebuilds on reconfigure (#10102) 2026-07-12 20:07:41 -07:00
z3_add_cxx_flag.cmake [CMake] Change the WARNINGS_AS_ERRORS option from BOOL to STRING 2017-07-09 14:34:30 +01:00
z3_append_linker_flag_list_to_target.cmake mux 2019-06-05 09:06:17 +01:00
Z3Config.cmake.in Fix Z3Config.cmake.in when generating a static library (#5555) 2021-09-17 18:03:10 +01:00