From 01243361d06bf087535b26afa3c04ce5df24d630 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Tue, 11 Nov 2025 21:25:28 +0100 Subject: cmake.eclass: Improve cmake_comment_add_subdirectory, fix min arg check Thanks-to: Zurab Kvachadze Signed-off-by: Andreas Sturmlechner --- eclass/cmake.eclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'eclass') diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 069a332bd9a..d483d4b324c 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 expected" + die "${FUNCNAME[0]}: bad number of arguments: -f 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})" -- cgit v1.2.3