1 |
commit: 0814334901bc20945e98eacebed6f44a53d91713 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 30 16:30:28 2020 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 1 18:50:49 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08143349 |
7 |
|
8 |
cmake.eclass: cmake_run_in: New function |
9 |
|
10 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
11 |
|
12 |
eclass/cmake.eclass | 16 ++++++++++++++++ |
13 |
1 file changed, 16 insertions(+) |
14 |
|
15 |
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass |
16 |
index f43d5af0f7a..5ea1bd125c7 100644 |
17 |
--- a/eclass/cmake.eclass |
18 |
+++ b/eclass/cmake.eclass |
19 |
@@ -147,6 +147,22 @@ _cmake_check_build_dir() { |
20 |
einfo "Working in BUILD_DIR: \"$BUILD_DIR\"" |
21 |
} |
22 |
|
23 |
+# @FUNCTION: cmake_run_in |
24 |
+# @USAGE: <working dir> <run command> |
25 |
+# @DESCRIPTION: |
26 |
+# Set the desired working dir for a function or command. |
27 |
+cmake_run_in() { |
28 |
+ if [[ -z ${2} ]]; then |
29 |
+ die "${FUNCNAME[0]} must be passed at least two arguments" |
30 |
+ fi |
31 |
+ |
32 |
+ [[ -e ${1} ]] || die "${FUNCNAME[0]}: Nonexistent path: ${1}" |
33 |
+ |
34 |
+ pushd ${1} > /dev/null || die |
35 |
+ "${@:2}" |
36 |
+ popd > /dev/null || die |
37 |
+} |
38 |
+ |
39 |
# @FUNCTION: cmake_comment_add_subdirectory |
40 |
# @USAGE: <subdirectory> |
41 |
# @DESCRIPTION: |