cmake.eclass: Avoid false positives by ensuring we find a function call

Otherwise the regex might pick up a query of the resulting version var, e.g.:

> if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)

Closes: https://bugs.gentoo.org/958923
Closes: https://bugs.gentoo.org/958974
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
This commit is contained in:
Andreas Sturmlechner
2025-06-22 23:08:48 +02:00
parent e94be3351b
commit da8dbff8c1

View File

@@ -336,7 +336,7 @@ _cmake_check_build_dir() {
# Returns 0 if the regex matched (a lower-than-specified version found).
_cmake_minreqver-lt() {
local ver chk=1
ver=$(sed -ne "/cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9][0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \
ver=$(sed -ne "/^\s*cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9][0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \
"${2}" 2>/dev/null \
)
if [[ -n ${ver} ]] && ver_test "${ver}" -lt "${1}"; then