commit:     da8dbff8c15a12c4dc1f3e3bbc3995b58786491e
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 22 21:08:48 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Jun 24 19:44:05 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da8dbff8

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 <AT> gentoo.org>

 eclass/cmake.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 109227edfe02..2e799f14352e 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -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

Reply via email to