On Wed, Nov 13, 2024 at 04:30:33PM +0000, Phillip Wood wrote: > Hi Patrick > > On 12/11/2024 17:02, Patrick Steinhardt wrote: > > Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into > > the current directory, where the expectation is that it should exist in > > the source directory. But other build systems that support out-of-tree > > builds may not want to do that to keep the source directory pristine, > > even though CMake currently doesn't care. > > > > Refactor the script such that it doesn't write output to a file anymore > > but so that it instead writes the version to stdout. This makes it > > easier to compute the same version as our Makefile would without having > > to write the "GIT-VERSION-FILE". > > This patch moves the logic that only updates GIT-VERSION-FILE if the > version has changed from the script into the Makefile. As we really want > the CMake and meson builds to set the string at build time which > probably means extending GIT-VERSION-GEN to write a header file that > defines GIT_VERSION etc. I'm not sure this is a good direction. In the > long run I think we'd be better off with something like the patch below. Yes, I fully agree that using a version header would make more sense. I had the intent to do this as a follow-up, but I'll have a look at your patch and maybe do it now already. Thanks! Patrick