commit:     aa8f73fd21216e3d4b7d964641ee8cb275bde04d
Author:     Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Sun Aug 21 18:17:22 2016 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Wed Aug 31 14:23:26 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa8f73fd

cmake-utils.eclass: Let cmake_comment_add_subdirectory take n arguments

 eclass/cmake-utils.eclass | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 6363d31..393ee28 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -262,15 +262,18 @@ _cmake_generator_to_use() {
 # @FUNCTION: cmake_comment_add_subdirectory
 # @USAGE: <subdirectory>
 # @DESCRIPTION:
-# Comment out an add_subdirectory call in CMakeLists.txt in the current 
directory
+# 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 the directory name 
to comment"
+               die "comment_add_subdirectory must be passed at least one 
directory name to comment"
        fi
 
        if [[ -e "CMakeLists.txt" ]]; then
-               sed -e 
"/add_subdirectory[[:space:]]*([[:space:]]*${1//\//\\/}[[:space:]]*)/I 
s/^/#DONOTCOMPILE /" \
-                       -i CMakeLists.txt || die "failed to comment 
add_subdirectory(${1})"
+               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
 }
 

Reply via email to