summaryrefslogtreecommitdiff
path: root/CC/foreign/cmake/EXPRESSIONS
diff options
context:
space:
mode:
Diffstat (limited to 'CC/foreign/cmake/EXPRESSIONS')
-rw-r--r--CC/foreign/cmake/EXPRESSIONS45
1 files changed, 38 insertions, 7 deletions
diff --git a/CC/foreign/cmake/EXPRESSIONS b/CC/foreign/cmake/EXPRESSIONS
index fe5931e..3b10de3 100644
--- a/CC/foreign/cmake/EXPRESSIONS
+++ b/CC/foreign/cmake/EXPRESSIONS
@@ -3,6 +3,8 @@
[ "source_dir"
, "cmake_options"
, "cmake_defines"
+ , "pre_cmds"
+ , "post_cmds"
, "CC"
, "CXX"
, "CFLAGS"
@@ -112,13 +114,42 @@
{ "type": "join"
, "separator": "\n"
, "$1":
- [ "set -eu"
- , "readonly CMAKE_AR=$(which $1)"
- , "shift"
- , "cmake \"$@\" -Ssource -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)"
- , "cmake --build build --target install >build.log || (cat configure.log build.log && exit 1)"
- , "find ./install -type l -delete"
- ]
+ { "type": "++"
+ , "$1":
+ [ [ "set -eu"
+ , "mkdir scratch"
+ , "readonly TMPDIR=\"$(pwd)/scratch\""
+ ]
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "pre_cmds"}
+ , "then":
+ { "type": "++"
+ , "$1":
+ [ ["(", "set --", "cd ./source"]
+ , {"type": "var", "name": "pre_cmds"}
+ , [")"]
+ ]
+ }
+ }
+ , [ "readonly CMAKE_AR=$(which $1)"
+ , "shift"
+ , "cmake \"$@\" -Ssource -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)"
+ , "cmake --build build --target install >build.log || (cat configure.log build.log && exit 1)"
+ , "find ./install -type l -delete"
+ ]
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "post_cmds"}
+ , "then":
+ { "type": "++"
+ , "$1":
+ [ ["(", "set --", "cd ./install"]
+ , {"type": "var", "name": "post_cmds"}
+ , [")"]
+ ]
+ }
+ }
+ ]
+ }
}
}
}