aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/module.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/cc/module.cxx')
-rw-r--r--libbuild2/cc/module.cxx32
1 files changed, 27 insertions, 5 deletions
diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx
index f3ce32b..641da5e 100644
--- a/libbuild2/cc/module.cxx
+++ b/libbuild2/cc/module.cxx
@@ -173,11 +173,19 @@ namespace build2
rs.assign (x_class) = to_string (xi.class_);
- rs.assign (x_version) = xi.version.string;
- rs.assign (x_version_major) = xi.version.major;
- rs.assign (x_version_minor) = xi.version.minor;
- rs.assign (x_version_patch) = xi.version.patch;
- rs.assign (x_version_build) = xi.version.build;
+ auto assign_version = [&rs] (const variable** vars,
+ const compiler_version* v)
+ {
+ rs.assign (vars[0]) = v != nullptr ? value (v->string) : value ();
+ rs.assign (vars[1]) = v != nullptr ? value (v->major) : value ();
+ rs.assign (vars[2]) = v != nullptr ? value (v->minor) : value ();
+ rs.assign (vars[3]) = v != nullptr ? value (v->patch) : value ();
+ rs.assign (vars[4]) = v != nullptr ? value (v->build) : value ();
+ };
+
+ assign_version (&x_version, &xi.version);
+ assign_version (&x_variant_version,
+ xi.variant_version ? &*xi.variant_version : nullptr);
// Also enter as x.target.{cpu,vendor,system,version,class} for
// convenience of access.
@@ -452,6 +460,20 @@ namespace build2
dr << " build " << xi.version.build << '\n';
}
+ if (xi.variant_version)
+ {
+ dr << " variant: " << '\n'
+ << " version " << xi.variant_version->string << '\n'
+ << " major " << xi.variant_version->major << '\n'
+ << " minor " << xi.variant_version->minor << '\n'
+ << " patch " << xi.variant_version->patch << '\n';
+ }
+
+ if (xi.variant_version && !xi.variant_version->build.empty ())
+ {
+ dr << " build " << xi.variant_version->build << '\n';
+ }
+
{
const string& ct (tt.string ()); // Canonical target.