Re: [PATCH v2] meson: ensure correct version-def.h is used
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 16, 2025, 09:43 UTC
- Message-ID
- <Z4jUsd77AFih24OW@pks.im>
- In-Reply-To
- <20250114-toon-fix-meson-version-v2-1-66ddb1a82c28@iotcl.com>
On Tue, Jan 14, 2025 at 12:15:23PM +0100, Toon Claes wrote:
Show 33 quoted lines
> diff --git a/meson.build b/meson.build
> index 0064eb64f546a6349a8694ce251bd352febda6fe..db27afa99986598aab22ada718f76a7a49238f24 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1493,7 +1493,9 @@ libgit_version_library = static_library('git-version',
> 'version.c',
> version_def_h,
> ],
> - c_args: libgit_c_args,
> + c_args: libgit_c_args + [
> + '-DGIT_VERSION_H="' + version_def_h.full_path() + '"',
> + ],
> dependencies: libgit_dependencies,
> include_directories: libgit_include_directories,
> )
> diff --git a/version.c b/version.c
> index 4d763ab48dd76c0445e5ea390ff4c1f35c1a4b12..4786c4e0a54093ca947da27f8b712bd1ea351203 100644
> --- a/version.c
> +++ b/version.c
> @@ -1,8 +1,13 @@
> #include "git-compat-util.h"
> #include "version.h"
> -#include "version-def.h"
> #include "strbuf.h"
>
> +#ifndef GIT_VERSION_H
> +# include "version-def.h"
> +#else
> +# include GIT_VERSION_H
> +#endif
> +
> const char git_version_string[] = GIT_VERSION;
> const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;Yup, this looks as expected. I'm fine with the solution (well, obviously, I proposed it), so this looks good to me.
Thanks!
Patrick