meson: ensure correct version-def.h is used
To build the libgit-version library, Meson first generates
version-def.h
in the build directory. Then it compiles version.c
into a library. During compilation, Meson tells to include both the
build directory and the project root directory.
However, when the user previously has compiled Git using Make, they will
have a version-def.h
file in project root directory as well. Because
version-def.h
is included in version.c
using the #include directive
with double quotes, some compilers will look for the header file in the
same directory as the source file. This will cause compilation of
version.c
ran by Meson to include version-def.h
previously made by
Make, which might be out of date.
Copy version.c
to the build directory before compiling it to ensure
version-def.h
from the build directory is used.