From 6a8953c64aaf7cfcd081f0750dcfb9c89aea49e7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Jun 2023 15:00:34 +0200 Subject: Diagnose non-global variable specified with --build-option (GH issue #276) --- bpkg/bpkg.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bpkg') diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 4af4140..b5eaf7d 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -158,6 +158,17 @@ namespace bpkg if (bo.help () || bo.version ()) fail << "--help or --version specified with --build-option"; + + // Make sure someone didn't specify a non-global override with + // --build-option, which messes our global/package-specific config + // variable split. + // + for (const string& v: bc.cmd_vars) + { + if (v[0] != '!') + fail << "non-global configuration variable '" << v + << "' specified with --build-option"; + } } build2_cmd_vars = move (bc.cmd_vars); -- cgit v1.1