From 85d33a51cdc7e183bb96d8b7026ba391eedd55d7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Apr 2015 16:48:28 +0200 Subject: Make config module implicitly load config.build if exists --- build/config/module.cxx | 24 +++++++++--------------- build/root.build | 2 -- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/build/config/module.cxx b/build/config/module.cxx index 426b1f6..2e676ff 100644 --- a/build/config/module.cxx +++ b/build/config/module.cxx @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -17,19 +18,9 @@ namespace build { namespace config { - static bool - trigger (bool pre, scope& base, path& p) - { - tracer trace ("config::trigger"); - - if (pre) - { - level4 ([&]{trace << "intercepted sourcing of " << p;}); - return file_exists (p); - } - else - return true; - } + //@@ Same as in operation.cxx + // + static const path config_file ("build/config.build"); void init (scope& root, scope& base, const location& l) @@ -51,9 +42,12 @@ namespace build root.meta_operations.insert (disfigure) != disfigure_id) fail (l) << "config module must be initialized before other modules"; - // Register the build/config.build sourcing trigger. + // Load config.build if one exists. // - root.triggers[out_root / path ("build/config.build")] = &trigger; + path f (out_root / config_file); + + if (file_exists (f)) + source (f, root, root); } } } diff --git a/build/root.build b/build/root.build index 7321d32..89d8251 100644 --- a/build/root.build +++ b/build/root.build @@ -1,5 +1,3 @@ -source $out_root/build/config.build - using cxx cxx.std = 14 -- cgit v1.1