fish-shell/cmake
ridiculousfish d09210c08b [cmake] Untangle the CMake versioning
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.

The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.

This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.

We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
2018-01-08 22:28:10 -08:00
..
CheckIncludeFiles.cmake cmake: update CheckIncludeFiles to enable C++ checks 2017-11-17 16:21:56 +08:00
ConfigureChecks.cmake cmake: add SED to build_lexicon_filter 2017-11-28 21:37:42 +08:00
Docs.cmake [cmake] Untangle the CMake versioning 2018-01-08 22:28:10 -08:00
gettext.cmake cmake: correct configure check for _nl_msg_cat_cntr 2017-11-17 16:21:56 +08:00
Install.cmake [cmake] Untangle the CMake versioning 2018-01-08 22:28:10 -08:00
PCRE2.cmake Move CMakeFiles to cmake 2017-11-17 16:21:55 +08:00
Tests.cmake Mark tests as USES_TERMINAL 2017-12-21 12:48:17 -08:00
Version.cmake [cmake] Untangle the CMake versioning 2018-01-08 22:28:10 -08:00