simon-git: puzzles (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Tue Jan 17 19:06:57 GMT 2023


TL;DR:
  80f64cf Avoid unnecessary timestamp bumps on generated-games.h.

Repository:     https://git.tartarus.org/simon/puzzles.git
On the web:     https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2023-01-17 19:06:57

commit 80f64cfcdafd3d0c4578ad7d559f38018d583c15
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=80f64cfcdafd3d0c4578ad7d559f38018d583c15;hp=1dc1ed786fda790f60f2fe9f8e7c404c73ae64da
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Jan 17 19:00:17 2023 +0000

    Avoid unnecessary timestamp bumps on generated-games.h.
    
    If I re-run cmake in a Unix build directory, it unconditionally
    rewrites generated-games.h, which causes fuzzpuzz to be rebuilt. This
    is a waste of effort in the extremely common case where the rewritten
    generated-games.h is identical to the old one.
    
    Now we write the data to a temporary file first, and use cmake's
    'configure_file' command to copy that to generated-games.h, because it
    so happens that configure_file checks if the two files are identical
    and avoids updating the timestamp on the destination file if so.
    
    (This will presumably also be a beneficial change on any other
    platform that uses generated_games.h in the build, such as OS X. I
    just hadn't noticed until it hit the build I most often re-run in an
    existing build directory.)
    
    cmake 3.21 has a more intuitively spelled command I could have used,
    called 'file(COPY_FILE src dst ONLY_IF_DIFFERENT)'. But we currently
    permit cmake all the way back to 3.5, so I can't use that.

 cmake/setup.cmake | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)



More information about the tartarus-commits mailing list