We need to ramp up detection of unsupported CMake build systems with
CMake 4. This will detect CMakeLists.txt files setting insufficient cmake_minimum_required VERSION level even in project subdirectories,
putting out appropriate eqawarn message about the need to fix ${PN}.
That makes us not rely on tinderbox runs w/ unmasked cmake-4 slowly
being able to build everything up to leaf packages, and also helps
detect insufficient subproject minimums that could otherwise be masked
by USE flag choice.
Problems fixed along the way:
- Make sed case-insensitive
- CMake version range may have double- or triple-dots
- Exit after first match
We don't want more than one version for the subsequent ver_test.
Besides, any follow-up cmake_minimum_required call will most likely
be conditional for some type of workarounds.
Thanks-to: Sam James <
sam@gentoo.org>
Thanks-to: Ionen Wolkens <
ionen@gentoo.org>
Thanks-to: Michał Górny <
mgorny@gentoo.org>
Bug:
https://bugs.gentoo.org/951350
Signed-off-by: Andreas Sturmlechner <
asturm@gentoo.org>
---
eclass/cmake.eclass | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index c97f74e8a2ed..4c91afa160d9 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -445,6 +445,17 @@ cmake_src_configure() {
# Fix xdg collision with sandbox
xdg_environment_reset
+ local file ver cmreq_isold
+ while read -d '' -r file ; do
+ ver=$(sed -ne "/cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \
+ "${file}" 2>/dev/null \
+ )
+
+ if [[ -n $ver ]] && ver_test $ver -lt "3.5"; then
+ cmreq_isold=true
+ fi
+ done < <(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -print0)
+
# Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.)
local build_rules=${BUILD_DIR}/gentoo_rules.cmake
@@ -625,6 +636,16 @@ cmake_src_configure() {
cmakeargs+=( -C "${CMAKE_EXTRA_CACHE_FILE}" )
fi
+ if [[ ${cmreq_isold} ]]; then
+ eqawarn "QA Notice: Compatibilit