scx-upstream/meson-scripts/get_clang_ver
Andrea Righi 00cd15a3ae build: properly detect clang version in Ubuntu
Some distro may add their own prefix to the version string of clang, for
example in Ubuntu:

 $ clang --version
 Ubuntu clang version 17.0.5 (1ubuntu1)
 ...

That triggers the following meson error during the setup phase:

 meson.build:25:44: ERROR: String '' cannot be converted to int

Change the regexp used to evaluate the clang version to avoid this
build failure.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2023-12-07 19:24:12 +01:00

4 lines
82 B
Bash
Executable File

#!/bin/bash
"$1" --version | sed -nr 's/^.*clang version ([\.0-9]*)( .*)?$/\1/p'