// file : build2/config/utility.txx -*- C++ -*- // copyright : Copyright (c) 2014-2016 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include namespace build2 { namespace config { template pair, bool> required (scope& root, const variable& var, const T& def_value, bool ovr) { using result = pair, bool>; if (auto l = root[var]) { if (l.belongs (*global_scope)) return result (root.assign (var) = *l, true); if (!ovr || l.belongs (root)) return result (*l, false); } return result (root.assign (var) = def_value, true); } } }