diff options
author | 2014-01-15 18:26:59 +1100 | |
---|---|---|
committer | 2014-01-15 18:26:59 +1100 | |
commit | d5089f2307204bece774118f45145eba4fc4b45b (patch) | |
tree | a838edbf3be52c8337c8c4b5f5eb73640a65bb99 /eclass | |
parent | [eclass] Control FRAMEWORKS_DOXYGEN with false in preparation for future doxy... (diff) | |
download | kde-d5089f2307204bece774118f45145eba4fc4b45b.tar.gz kde-d5089f2307204bece774118f45145eba4fc4b45b.tar.bz2 kde-d5089f2307204bece774118f45145eba4fc4b45b.zip |
[eclass] Add new function comment_add_subdirectory to avoid code duplication.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/kde-frameworks.eclass | 9 | ||||
-rw-r--r-- | eclass/kde4-functions.eclass | 14 |
2 files changed, 17 insertions, 6 deletions
diff --git a/eclass/kde-frameworks.eclass b/eclass/kde-frameworks.eclass index bd64b393a9..444060fdfd 100644 --- a/eclass/kde-frameworks.eclass +++ b/eclass/kde-frameworks.eclass @@ -224,19 +224,16 @@ kde-frameworks_src_prepare() { debug-print-function ${FUNCNAME} "$@" # never build manual tests - sed -e "/add_subdirectory[[:space:]]*([[:space:]]*tests[[:space:]]*)/s/^/#DONOTCOMPILE /" \ - -i CMakeLists.txt || die + comment_add_subdirectory tests # only build examples when required if ! in_iuse examples || ! use examples ; then - sed -e "/add_subdirectory[[:space:]]*([[:space:]]*examples[[:space:]]*)/s/^/#DONOTCOMPILE /" \ - -i CMakeLists.txt || die + comment_add_subdirectory examples fi # only build unit tests when required if ! in_iuse test || ! use test ; then - sed -e "/add_subdirectory[[:space:]]*([[:space:]]*autotests[[:space:]]*)/s/^/#DONOTCOMPILE /" \ - -i CMakeLists.txt || die + comment_add_subdirectory autotests fi cmake-utils_src_prepare diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass index 7e1a96029f..64f26df626 100644 --- a/eclass/kde4-functions.eclass +++ b/eclass/kde4-functions.eclass @@ -124,6 +124,20 @@ buildsycoca() { done } +# @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 + + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${1}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ + -i CMakeLists.txt || die "failed to comment add_subdirectory(${1})" + +} + # @FUNCTION: comment_all_add_subdirectory # @USAGE: [list of directory names] # @DESCRIPTION: |