Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 31 Aug 2016 14:23:54
Message-Id: 1472653406.aa8f73fd21216e3d4b7d964641ee8cb275bde04d.kensington@gentoo
1 commit: aa8f73fd21216e3d4b7d964641ee8cb275bde04d
2 Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
3 AuthorDate: Sun Aug 21 18:17:22 2016 +0000
4 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 31 14:23:26 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa8f73fd
7
8 cmake-utils.eclass: Let cmake_comment_add_subdirectory take n arguments
9
10 eclass/cmake-utils.eclass | 11 +++++++----
11 1 file changed, 7 insertions(+), 4 deletions(-)
12
13 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
14 index 6363d31..393ee28 100644
15 --- a/eclass/cmake-utils.eclass
16 +++ b/eclass/cmake-utils.eclass
17 @@ -262,15 +262,18 @@ _cmake_generator_to_use() {
18 # @FUNCTION: cmake_comment_add_subdirectory
19 # @USAGE: <subdirectory>
20 # @DESCRIPTION:
21 -# Comment out an add_subdirectory call in CMakeLists.txt in the current directory
22 +# Comment out one or more add_subdirectory calls in CMakeLists.txt in the current directory
23 cmake_comment_add_subdirectory() {
24 if [[ -z ${1} ]]; then
25 - die "comment_add_subdirectory must be passed the directory name to comment"
26 + die "comment_add_subdirectory must be passed at least one directory name to comment"
27 fi
28
29 if [[ -e "CMakeLists.txt" ]]; then
30 - sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${1//\//\\/}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
31 - -i CMakeLists.txt || die "failed to comment add_subdirectory(${1})"
32 + local d
33 + for d in $@; do
34 + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d//\//\\/}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \
35 + -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})"
36 + done
37 fi
38 }