aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-27 00:21:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-27 00:21:41 +0300
commit4caed823a8c762676fe57ff646bf19b6c14e9f6e (patch)
tree0f6d4597834c0ac4580d8234d235255c08d8cbe1 /libbuild2/buildfile
parent4a23b4cdf3102a8fef8ac6ebd8a884cd613c28ee (diff)
Don't set import.build2 variable in cross-compiled build2
Diffstat (limited to 'libbuild2/buildfile')
-rw-r--r--libbuild2/buildfile13
1 files changed, 7 insertions, 6 deletions
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index deda991..3c4566a 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -73,13 +73,14 @@ obja{*}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD
objs{*}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD
# Pass our compiler target to be used as build2 host and our out_root to
-# be used as the build system import path.
+# be used as the build system import path (not forgetting to escape
+# backslashes on Windows).
#
-obj{context}:
-{
- cxx.poptions += "-DBUILD2_HOST_TRIPLET=\"$cxx.target\""
- cxx.poptions += "-DBUILD2_IMPORT_PATH=\"$out_root\""
-}
+obj{context}: cxx.poptions += "-DBUILD2_HOST_TRIPLET=\"$cxx.target\""
+
+if ($cxx.target == $build.host)
+ obj{context}: cxx.poptions += \
+ "-DBUILD2_IMPORT_PATH=\"$regex.replace($out_root, '\\', '\\\\')\""
obja{context}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD
objs{context}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD