aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-20 14:46:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-20 14:46:58 +0200
commitb4286df8c9bafdab1934cef99ccc0506ec4555e2 (patch)
tree1d24c1f03a7ff8d4ca1de29deaa9d751b8eef6c7
parent024161a19edd411ae249ec5fec503aff2409bc67 (diff)
Add builtin.concat(dir_path,name) overload
In particular, this allows: export $out_root/libfoo/$import.target
-rw-r--r--build2/function.cxx2
-rw-r--r--build2/functions-name.cxx28
2 files changed, 30 insertions, 0 deletions
diff --git a/build2/function.cxx b/build2/function.cxx
index 0b432d3..f1e0fdd 100644
--- a/build2/function.cxx
+++ b/build2/function.cxx
@@ -368,6 +368,7 @@ namespace build2
void builtin_functions (); // functions-builtin.cxx
void filesystem_functions (); // functions-filesystem.cxx
+ void name_functions (); // functions-name.cxx
void path_functions (); // functions-path.cxx
void process_functions (); // functions-process.cxx
void process_path_functions (); // functions-process-path.cxx
@@ -381,6 +382,7 @@ namespace build2
{
builtin_functions ();
filesystem_functions ();
+ name_functions ();
path_functions ();
process_functions ();
process_path_functions ();
diff --git a/build2/functions-name.cxx b/build2/functions-name.cxx
new file mode 100644
index 0000000..1bdff11
--- /dev/null
+++ b/build2/functions-name.cxx
@@ -0,0 +1,28 @@
+// file : build2/functions-name.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <build2/function.hxx>
+#include <build2/variable.hxx>
+
+using namespace std;
+
+namespace build2
+{
+ void
+ name_functions ()
+ {
+ // function_family f ("name");
+
+ // Name-specific overloads from builtins.
+ //
+ function_family b ("builtin");
+
+ b[".concat"] = [](dir_path d, name n)
+ {
+ d /= n.dir;
+ n.dir = move (d);
+ return n;
+ };
+ }
+}