summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2014-10-15 13:44:24 +0000
committerMichael Palimaka <kensington@gentoo.org>2014-10-15 13:44:24 +0000
commit2bf493a70c1090fae4e705e14ae99672348c3d8e (patch)
tree7af4de27beab624086e422b8f8ffa7cd898b62bb /eclass/cmake-utils.eclass
parentversion bumped 31.x ESR (restoring a 31.x version to the tree, bug 525486), s... (diff)
downloadgentoo-2-2bf493a70c1090fae4e705e14ae99672348c3d8e.tar.gz
gentoo-2-2bf493a70c1090fae4e705e14ae99672348c3d8e.tar.bz2
gentoo-2-2bf493a70c1090fae4e705e14ae99672348c3d8e.zip
Introduce comment_add_subdirectory function. Make EAPI check more technically correct.
Diffstat (limited to 'eclass/cmake-utils.eclass')
-rw-r--r--eclass/cmake-utils.eclass21
1 files changed, 18 insertions, 3 deletions
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index ec40d3b12466..0dfcbd453b44 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.110 2014/08/12 14:58:40 kensington Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-utils.eclass,v 1.111 2014/10/15 13:44:24 kensington Exp $
# @ECLASS: cmake-utils.eclass
# @MAINTAINER:
@@ -118,9 +118,9 @@ case ${WANT_CMAKE} in
esac
inherit toolchain-funcs multilib flag-o-matic eutils
-case ${EAPI:-0} in
+case ${EAPI} in
2|3|4|5) : ;;
- *) die "EAPI=${EAPI} is not supported" ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
esac
CMAKE_EXPF="src_prepare src_configure src_compile src_test src_install"
@@ -238,6 +238,21 @@ _generator_to_use() {
echo ${generator_name}
}
+# @FUNCTION: comment_add_subdirectory
+# @USAGE: <subdirectory>
+# @DESCRIPTION:
+# Comment out an add_subdirectory call in CMakeLists.txt in the current directory
+comment_add_subdirectory() {
+ if [[ -z ${1} ]]; then
+ die "comment_add_subdirectory must be passed the directory name to comment"
+ fi
+
+ if [[ -e "CMakeLists.txt" ]]; then
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${1//\//\\/}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
+ -i CMakeLists.txt || die "failed to comment add_subdirectory(${1})"
+ fi
+}
+
# @FUNCTION: cmake-utils_use_with
# @USAGE: <USE flag> [flag name]
# @DESCRIPTION: