Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 01 Sep 2020 18:51:06
Message-Id: 1598986250.ba0067d9fd8c099bb16bb3c771f37be8fd323f31.asturm@gentoo
1 commit: ba0067d9fd8c099bb16bb3c771f37be8fd323f31
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 30 17:13:07 2020 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 1 18:50:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba0067d9
7
8 cmake.eclass: cmake_comment_add_subdirectory: line length reduction
9
10 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
11
12 eclass/cmake.eclass | 17 +++++++++--------
13 1 file changed, 9 insertions(+), 8 deletions(-)
14
15 diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
16 index 5ea1bd125c7..5505fd21ac0 100644
17 --- a/eclass/cmake.eclass
18 +++ b/eclass/cmake.eclass
19 @@ -169,16 +169,17 @@ cmake_run_in() {
20 # Comment out one or more add_subdirectory calls in CMakeLists.txt in the current directory
21 cmake_comment_add_subdirectory() {
22 if [[ -z ${1} ]]; then
23 - die "comment_add_subdirectory must be passed at least one directory name to comment"
24 + die "${FUNCNAME[0]} must be passed at least one directory name to comment"
25 fi
26
27 - if [[ -e "CMakeLists.txt" ]]; then
28 - local d
29 - for d in $@; do
30 - sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d//\//\\/}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
31 - -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})"
32 - done
33 - fi
34 + [[ -e "CMakeLists.txt" ]] || return
35 +
36 + local d
37 + for d in $@; do
38 + d=${d//\//\\/}
39 + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
40 + -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})"
41 + done
42 }
43
44 # @FUNCTION: comment_add_subdirectory