commit: ba0067d9fd8c099bb16bb3c771f37be8fd323f31
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 30 17:13:07 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Sep 1 18:50:50 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba0067d9
cmake.eclass: cmake_comment_add_subdirectory: line length reduction
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/cmake.eclass | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 5ea1bd125c7..5505fd21ac0 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