diff options
| author | Andreas Sturmlechner <asturm@gentoo.org> | 2020-08-30 18:30:28 +0200 |
|---|---|---|
| committer | Andreas Sturmlechner <asturm@gentoo.org> | 2020-08-30 19:23:03 +0200 |
| commit | 7c8eb2dee113a4770eb562ebcd5c8e08ef01c672 (patch) | |
| tree | 71eafb94f70366ba45c4057748e97e941ea66954 | |
| parent | 42312bf95e3b28e76f6b6018e07727713c0f71f7 (diff) | |
| download | kde-7c8eb2dee113a4770eb562ebcd5c8e08ef01c672.tar.gz kde-7c8eb2dee113a4770eb562ebcd5c8e08ef01c672.tar.bz2 kde-7c8eb2dee113a4770eb562ebcd5c8e08ef01c672.zip | |
cmake.eclass: cmake_run_in: New function
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
| -rw-r--r-- | eclass/cmake.eclass | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index 9f475380183..240ab87bf6e 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -147,6 +147,22 @@ _cmake_check_build_dir() { einfo "Working in BUILD_DIR: \"$BUILD_DIR\"" } +# @FUNCTION: cmake_run_in +# @USAGE: <working dir> <run command> +# @DESCRIPTION: +# Set the desired working dir for a function or command. +cmake_run_in() { + if [[ -z ${2} ]]; then + die "${FUNCNAME[0]} must be passed at least two arguments" + fi + + [[ -e ${1} ]] || die "${FUNCNAME[0]}: Nonexistent path: ${1}" + + pushd ${1} > /dev/null || die + "${@:2}" + popd > /dev/null || die +} + # @FUNCTION: cmake_comment_add_subdirectory # @USAGE: <subdirectory> # @DESCRIPTION: |
