aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/buildfile
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-08 13:31:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-08 13:48:37 +0200
commit1c30f9e9c4fca846f05e881638920a9beb082fd1 (patch)
tree21c14ea34baca0a25e7fb245e92d2cd19b4ac7e7 /libbuild2/buildfile
parent957e150b49fce148c51a13bca0aa9f754ac2c4cb (diff)
Add support for buildfile importation
Diffstat (limited to 'libbuild2/buildfile')
-rw-r--r--libbuild2/buildfile35
1 files changed, 29 insertions, 6 deletions
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index b3a9c52..6d7c597 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -191,14 +191,37 @@ if! $cross
{
{obja objs}{context}: cxx.poptions += \
-DBUILD2_IMPORT_PATH=\"$regex.replace($out_root, '\\', '\\\\')\"
+}
+
+# Note that while the -installed object file should only be linked when we
+# are installing, it will be compiled even in the uninstalled case.
+#
+if ($install.root != [null])
+{
+ # Only if installed.
+ #
+ {obja objs}{utility-installed}: cxx.poptions += \
+ -DBUILD2_INSTALL_LIB=\"$regex.replace(\
+ $install.resolve($install.lib), '\\', '\\\\')\"
- # While this object file should only be linked when we are installing, it
- # will be compiled even in the uninstalled case.
+ # Only if configured.
+ #
+ # Note: strip the last directory component (<project>).
#
- if ($install.root != [null])
- {obja objs}{utility-installed}: cxx.poptions += \
- -DBUILD2_INSTALL_LIB=\"$regex.replace(\
- $install.resolve($install.lib), '\\', '\\\\')\"
+ # @@ TMP drop after 0.16.0 release.
+ #
+ install_buildfile = ($install.buildfile != [null] \
+ ? $directory($install.resolve($install.buildfile)) \
+ :)
+ {obja objs}{utility-installed utility-uninstalled}: cxx.poptions += \
+ -DBUILD2_INSTALL_BUILDFILE=\"$regex.replace($install_buildfile, '\\', '\\\\')\"
+
+ #\
+ {obja objs}{utility-installed utility-uninstalled}: cxx.poptions += \
+ -DBUILD2_INSTALL_BUILDFILE=\"$regex.replace(\
+ $directory($install.resolve($install.buildfile)), '\\', '\\\\')\"
+ #\
+
}
if ($cxx.target.class != 'windows')