commit: bc4d5d0944cb44e5d6de4a7af34ff5cd6ea3a53f
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 12 21:34:57 2025 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Oct 14 22:03:20 2025 +0000
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=bc4d5d09
cmake.eclass: Check and warn about <3.10 CMake minimum versions
- _cmake_minreqver-check():
Results are stored in new _CMAKE_MINREQVER_CMAKE310 array.
- _cmake_minreqver-info():
Dump _CMAKE_MINREQVER_CMAKE310 array as eqawarn
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/cmake.eclass | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 77ba1ccfac..dfa59bf06f 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -132,6 +132,15 @@ fi
# version lower than 3.5.
_CMAKE_MINREQVER_CMAKE305=()
+# @ECLASS_VARIABLE: _CMAKE_MINREQVER_CMAKE310
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Internal array containing <file>:<version> tuples detected by
+# _cmake_minreqver-check() for any CMakeLists.txt with cmake_minimum_required
+# version lower than 3.10 (causes CMake warnings as of 4.0) on top of those
+# already added to _CMAKE_MINREQVER_CMAKE305.
+_CMAKE_MINREQVER_CMAKE310=()
+
# @ECLASS_VARIABLE: CMAKE_QA_SRC_DIR_READONLY
# @USER_VARIABLE
# @DEFAULT_UNSET
@@ -280,6 +289,11 @@ _cmake_minreqver-check() {
_CMAKE_MINREQVER_CMAKE305+=( "${file}":"${ver}" )
chk=0
fi
+ # we don't want duplicates that were already flagged
+ if [[ $chk != 0 ]] && ver_test "${ver}" -lt "3.10"; then
+ _CMAKE_MINREQVER_CMAKE310+=( "${file}":"${ver}" )
+ chk=0
+ fi
fi
return ${chk}
}
@@ -287,8 +301,13 @@ _cmake_minreqver-check() {
# @FUNCTION: _cmake_minreqver-info
# @INTERNAL
# @DESCRIPTION:
-# QA notice printout for build systems unsupported w/ CMake-4.
+# QA Notice and file listings for any CMakeLists.txt found with
+# cmake_minimum_required versions lower than supported or deprecated by CMake
4.
_cmake_minreqver-info() {
+ if [[ -z ${_CMAKE_MINREQVER_CMAKE305[@]} ]] &&
+ [[ -z ${_CMAKE_MINREQVER_CMAKE310[@]} ]]; then
+ return
+ fi
local info
if [[ -n ${_CMAKE_MINREQVER_CMAKE305[@]} ]]; then
eqawarn "QA Notice: Compatibility with CMake < 3.5 has been
removed from CMake 4,"
@@ -306,7 +325,24 @@ _cmake_minreqver-info() {
eqawarn "This is merely a workaround to avoid CMake
Error and *not* a permanent fix;"
eqawarn "there may be new build or runtime bugs as a
result."
fi
+ eqawarn
+ fi
+ if [[ -n ${_CMAKE_MINREQVER_CMAKE305[@]} ]] ||
+ [[ -n ${_CMAKE_MINREQVER_CMAKE310[@]} ]]; then
+ eqawarn "QA Notice: Compatibility with CMake < 3.10 will be
removed in a future release."
+ eqawarn "If not fixed in upstream's code repository, we should
make sure they are aware."
+ eqawarn
+ if [[ -n ${_CMAKE_MINREQVER_CMAKE310[@]} ]]; then
+ eqawarn "The following CMakeLists.txt files are causing
warnings:"
+ for info in ${_CMAKE_MINREQVER_CMAKE310[*]}; do
+ eqawarn " ${info}"
+ done
+ eqawarn
+ fi
fi
+ eqawarn "An upstreamable patch should take any resulting CMake policy
changes"
+ eqawarn "into account. See also:"
+ eqawarn "
https://cmake.org/cmake/help/latest/manual/cmake-policies.7.html"
}
# @FUNCTION: _cmake_modify-cmakelists