commit: 01243361d06bf087535b26afa3c04ce5df24d630
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 11 20:25:28 2025 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Nov 11 20:29:45 2025 +0000
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=01243361
cmake.eclass: Improve cmake_comment_add_subdirectory, fix min arg check
Thanks-to: Zurab Kvachadze <zurabid2016 <AT> gmail.com>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/cmake.eclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 069a332bd9..d483d4b324 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -223,11 +223,11 @@ cmake_run_in() {
cmake_comment_add_subdirectory() {
local d filename="CMakeLists.txt"
if [[ $# -lt 1 ]]; then
- die "${FUNCNAME} must be passed at least one subdirectory name
to comment"
+ die "${FUNCNAME[0]} must be passed at least one subdirectory
name to comment"
fi
case ${1} in
-f)
- if [[ $# -ge 2 ]]; then
+ if [[ $# -ge 3 ]]; then
filename="${2}"
if [[ -d ${filename} ]]; then
filename+="/CMakeLists.txt"
@@ -239,7 +239,7 @@ cmake_comment_add_subdirectory() {
die "${FUNCNAME}: called on
non-existing ${filename}"
fi
else
- die "${FUNCNAME}: bad number of arguments: -f
<filename or directory> <subdirectory> expected"
+ die "${FUNCNAME[0]}: bad number of arguments:
-f <filename or directory> <subdirectory> expected"
fi
shift 2
;;
@@ -248,7 +248,7 @@ cmake_comment_add_subdirectory() {
;;
esac
- for d in $@; do
+ for d in "$@"; do
d=${d//\//\\/}
sed -e
"/add_subdirectory[[:space:]]*([[:space:]]*${d}[[:space:]]*)/I s/^/#DONOTBUILD
/" \
-i ${filename} || die "failed to comment
add_subdirectory(${d})"