meson: extract the version directly from ./VERSION without subprocesses

With the new minimum meson_version, it is possible to retrieve the
project version from a file by passing a files() output directly to the
version argument. It is no longer necessary to call run_command with
various arguments to configure its behavior, nor depend on a system
/usr/bin/cat (which admittedly does exist on non-Windows systems).

And meson will also treat the VERSION file as a build input, and
reconfigure the build if it changes -- meaning that the built binaries
are updated to have the correct version number (configure_file,
PACKAGE_VERSION, etc).

Signed-off-by: Eli Schwartz <[email protected]>
This commit is contained in:
Eli Schwartz committed 2026-10-27 12:21:42 -04:00
1 parent ede2251c36
commit dc4d6203a5
1 file changed
+1 -1
+1 -1
View File
@@ -1,5 +1,5 @@
project('zoitechat', 'c',
version: run_command('cat', 'VERSION', check: true).stdout().strip(),
version: files('VERSION'),
meson_version: '>= 0.59.0',
default_options: [
'c_std=c17',