From 6535bf6175af32e2514faf75d2742424751a783b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Apr 2015 14:10:50 +0200 Subject: New variables architecture Now operator[] is only used for lookup. --- build/cxx/module.cxx | 30 +++++++++++++++--------------- build/cxx/rule.cxx | 12 +----------- 2 files changed, 16 insertions(+), 26 deletions(-) (limited to 'build/cxx') diff --git a/build/cxx/module.cxx b/build/cxx/module.cxx index 3c9a4b6..e5c71e7 100644 --- a/build/cxx/module.cxx +++ b/build/cxx/module.cxx @@ -49,8 +49,8 @@ namespace build if (val) { - if (val.scope != global_scope) - break; // A value from config.build. + if (!val.belongs (*global_scope)) + break; // A value from (some) config.build. v = val.as (); } @@ -96,7 +96,7 @@ namespace build // Set on the project root. // - root.variables["config.cxx"] = move (v); + root.assign ("config.cxx") = move (v); } // config.cxx.{p,c,l}options @@ -113,11 +113,11 @@ namespace build if (v.defined ()) { - if (v.scope == global_scope) - root.variables["config.cxx.poptions"] = v; + if (v.belongs (*global_scope)) + root.assign ("config.cxx.poptions") = v; } else - root.variables["config.cxx.poptions"]; // Set to NULL. + root.assign ("config.cxx.poptions") = nullptr; } { @@ -125,11 +125,11 @@ namespace build if (v.defined ()) { - if (v.scope == global_scope) - root.variables["config.cxx.coptions"] = v; + if (v.belongs (*global_scope)) + root.assign ("config.cxx.coptions") = v; } else - root.variables["config.cxx.coptions"]; // Set to NULL. + root.assign ("config.cxx.coptions") = nullptr; } { @@ -137,11 +137,11 @@ namespace build if (v.defined ()) { - if (v.scope == global_scope) - root.variables["config.cxx.loptions"] = v; + if (v.belongs (*global_scope)) + root.assign ("config.cxx.loptions") = v; } else - root.variables["config.cxx.loptions"]; // Set to NULL. + root.assign ("config.cxx.loptions") = nullptr; } { @@ -149,11 +149,11 @@ namespace build if (v.defined ()) { - if (v.scope == global_scope) - root.variables["config.cxx.libs"] = v; + if (v.belongs (*global_scope)) + root.assign ("config.cxx.libs") = v; } else - root.variables["config.cxx.libs"]; // Set to NULL. + root.assign ("config.cxx.libs") = nullptr; } } } diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index a7ec2a6..bc105cf 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -576,17 +576,7 @@ namespace build // Set the -fPIC option if we are building a shared object. // if (so) - { - auto var (ot.variables["cxx.coptions"]); - - if (!var) - { - if (auto var1 = ot.base_scope ()["cxx.coptions"]) - var = var1; - } - - var += "-fPIC"; - } + ot.append ("cxx.coptions") += "-fPIC"; // If this target already exists, then it needs to be "compatible" // with what we are doing here. -- cgit v1.1