summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2020-08-30 19:13:07 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2020-08-30 19:23:03 +0200
commit16bf0280919858f9a2f9b93f7668396c3a66a1e8 (patch)
tree5a467800c47c1e280690b266343cbc1aa56d713c /eclass
parent7c8eb2dee113a4770eb562ebcd5c8e08ef01c672 (diff)
downloadkde-16bf0280919858f9a2f9b93f7668396c3a66a1e8.tar.gz
kde-16bf0280919858f9a2f9b93f7668396c3a66a1e8.tar.bz2
kde-16bf0280919858f9a2f9b93f7668396c3a66a1e8.zip
cmake.eclass: cmake_comment_add_subdirectory: line length reduction
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cmake.eclass17
1 files changed, 9 insertions, 8 deletions
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 240ab87bf6e..d9fb203edea 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -169,16 +169,17 @@ cmake_run_in() {
# Comment out one or more add_subdirectory calls in CMakeLists.txt in the current directory
cmake_comment_add_subdirectory() {
if [[ -z ${1} ]]; then
- die "comment_add_subdirectory must be passed at least one directory name to comment"
+ die "${FUNCNAME[0]} must be passed at least one directory name to comment"
fi
- if [[ -e "CMakeLists.txt" ]]; then
- local d
- for d in $@; do
- sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d//\//\\/}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
- -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})"
- done
- fi
+ [[ -e "CMakeLists.txt" ]] || return
+
+ local d
+ for d in $@; do
+ d=${d//\//\\/}
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
+ -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})"
+ done
}
# @FUNCTION: comment_add_subdirectory