From 83b5af87efef571b707fc1f409f22571a9f5054c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Aug 2016 16:23:37 +0200 Subject: Add support for ordering modules in config.build --- build2/cc/init.cxx | 4 ++++ build2/cc/module.cxx | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'build2/cc') diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx index 80e5027..5f8e2fb 100644 --- a/build2/cc/init.cxx +++ b/build2/cc/init.cxx @@ -87,6 +87,10 @@ namespace build2 // if (first) { + // Adjust module priority (compiler). + // + config::save_module (r, "cc", 250); + // config.cc.id // { diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index 4b51905..74c07e2 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -43,6 +43,15 @@ namespace build2 if (first) { + // Adjust module priority (compiler). Also order cc module before us + // (we don't want to use priorities for that in case someone manages + // to slot in-between). + // + if (!cc_loaded) + config::save_module (r, "cc", 250); + + config::save_module (r, x, 250); + const variable& config_c_coptions (var_pool["config.cc.coptions"]); // config.x @@ -66,7 +75,15 @@ namespace build2 cast_null (r["cc.pattern"])) : path (x_default)); - auto p1 (config::required (r, config_x, d)); + // If this value was hinted, save it as commented out so that if the + // user changes the source of the pattern, this one will get updated + // as well. + // + auto p1 (config::required (r, + config_x, + d, + false, + cc_loaded ? config::save_commented : 0)); p.first = &p1.first.get (); p.second = p1.second; } -- cgit v1.1