diff options
author | Sascha Roloff <sascha.roloff@huawei.com> | 2023-05-15 18:50:20 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-16 16:07:31 +0200 |
commit | db9ae6e0367c5dac8b0d37da00fe217e6b203af1 (patch) | |
tree | 7f3eabef460f43c84a62802a2e6770cf68b87d05 | |
parent | 0b679c18e2fcc3f8b217a2cc5a848ed1c6d56725 (diff) | |
download | rules-cc-db9ae6e0367c5dac8b0d37da00fe217e6b203af1.tar.gz |
Set CMAKE_{SOURCE,BINARY}_DIR in cmake build environment
Co-authored-by: Oliver Reiche <oliver.reiche@huawei.com>
-rw-r--r-- | CC/foreign/cmake/EXPRESSIONS | 7 | ||||
-rw-r--r-- | CC/foreign/cmake/RULES | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/CC/foreign/cmake/EXPRESSIONS b/CC/foreign/cmake/EXPRESSIONS index 5ff4667..8977d5a 100644 --- a/CC/foreign/cmake/EXPRESSIONS +++ b/CC/foreign/cmake/EXPRESSIONS @@ -169,7 +169,12 @@ , "then": { "type": "++" , "$1": - [ ["(", "set --", "cd ./install"] + [ [ "(" + , "set --" + , "readonly CMAKE_SOURCE_DIR=\"$(pwd)/source\"" + , "readonly CMAKE_BINARY_DIR=\"$(pwd)/build\"" + , "cd ./install" + ] , {"type": "var", "name": "post_cmds"} , [")"] ] diff --git a/CC/foreign/cmake/RULES b/CC/foreign/cmake/RULES index 8e8b934..8651f4e 100644 --- a/CC/foreign/cmake/RULES +++ b/CC/foreign/cmake/RULES @@ -50,7 +50,8 @@ , "installation but before the output files are collected. Useful for" , "renaming files or directories. Note that data between \"pre_cmds\" and" , "\"post_cmds\" can be exchanged via $TMPDIR, which is uniquely reserved" - , "for this action." + , "for this action. The CMake source and build directory can be accessed" + , "via $CMAKE_SOURCE_DIR and $CMAKE_BINARY_DIR, respectively." ] , "out_files": [ "Paths to the produced output files. The paths are considered relative" @@ -286,7 +287,9 @@ , "installation but before the output files are collected. Useful for" , "renaming files or directories (e.g., in case of SONAME mismatch). Note" , "that data between \"pre_cmds\" and \"post_cmds\" can be exchanged via" - , "$TMPDIR, which is uniquely reserved for this action." + , "$TMPDIR, which is uniquely reserved for this action. The CMake source" + , "and build directory can be accessed via $CMAKE_SOURCE_DIR and" + , "$CMAKE_BINARY_DIR, respectively." ] , "out_hdrs": [ "Paths to produced public header files. The path is considered" |