summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2020-08-30 18:30:28 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2020-09-01 20:50:49 +0200
commit0814334901bc20945e98eacebed6f44a53d91713 (patch)
treec677d1e792da8314122fc580958bd0c07d057d99 /eclass/cmake.eclass
parentkde.org.eclass: Fix invent.kde.org EGIT_REPO_URI (diff)
downloadgentoo-0814334901bc20945e98eacebed6f44a53d91713.tar.gz
gentoo-0814334901bc20945e98eacebed6f44a53d91713.tar.bz2
gentoo-0814334901bc20945e98eacebed6f44a53d91713.zip
cmake.eclass: cmake_run_in: New function
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass/cmake.eclass')
-rw-r--r--eclass/cmake.eclass16
1 files changed, 16 insertions, 0 deletions
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index f43d5af0f7ab..5ea1bd125c74 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: