From 6c3ed93c2761cebe46d581e40695c5d4370fca58 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sat, 5 Nov 2022 21:52:51 -0400 Subject: [PATCH] meson: get version up front Run the scraper command to establish the project version immediately, rather than wait for the build to be configured. This simplifies the code and ensures that project introspection works correctly. --- build/meson/meson.build | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/build/meson/meson.build b/build/meson/meson.build index f264760a3..98d556aa3 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -23,7 +23,9 @@ project('zstd', # so this isn't safe #'werror=true' ], - version: 'DUMMY', + version: run_command( + find_program('GetZstdLibraryVersion.py'), '../../lib/zstd.h', + check: true).stdout().strip(), meson_version: '>=0.48.0') cc = meson.get_compiler('c') @@ -45,16 +47,6 @@ compiler_msvc = 'msvc' zstd_version = meson.project_version() -zstd_h_file = join_paths(meson.current_source_dir(), '../../lib/zstd.h') -GetZstdLibraryVersion_py = find_program('GetZstdLibraryVersion.py', native : true) -r = run_command(GetZstdLibraryVersion_py, zstd_h_file) -if r.returncode() == 0 - zstd_version = r.stdout().strip() - message('Project version is now: @0@'.format(zstd_version)) -else - error('Cannot find project version in @0@'.format(zstd_h_file)) -endif - zstd_libversion = zstd_version # ============================================================================= -- 2.47.2