diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-03 15:04:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-03 15:09:40 +0200 |
commit | a8c2fa28947960cce78d905ac9bbcb490ec78382 (patch) | |
tree | c142c3910338cdfe77f6324f122cbfb474ec71dd /build2/cc | |
parent | f0da422177d416aef2e446b23e8bbf2ec79a9aab (diff) |
Add config.{c,cxx}.std
These values override {c,cxx}.std specified at the project level. In
particular, this allows us to force a specific standard for all the
projects in a build configuration, for example:
b create: conf/,cc config.cxx=g++ config.cxx.std=experimental
Diffstat (limited to 'build2/cc')
-rw-r--r-- | build2/cc/common.hxx | 4 | ||||
-rw-r--r-- | build2/cc/module.cxx | 19 |
2 files changed, 19 insertions, 4 deletions
diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index dec71ed..19733cf 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -43,6 +43,7 @@ namespace build2 const variable& config_x_id; // <type>[-<variant>] const variable& config_x_version; const variable& config_x_target; + const variable& config_x_std; const variable& config_x_poptions; const variable& config_x_coptions; const variable& config_x_loptions; @@ -53,6 +54,7 @@ namespace build2 const variable& x_sys_lib_dirs; // System library search directories. const variable& x_sys_inc_dirs; // System header search directories. + const variable& x_std; const variable& x_poptions; const variable& x_coptions; const variable& x_loptions; @@ -87,8 +89,6 @@ namespace build2 const variable& x_preprocessed; // x.preprocessed const variable* x_symexport; // x.features.symexport - const variable& x_std; - const variable& x_id; const variable& x_id_type; const variable& x_id_variant; diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index 1e3806a..7527da2 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -286,9 +286,24 @@ namespace build2 const compiler_info& ci (*ci_); const target_triplet& tt (cast<target_triplet> (rs[x_target])); - // Translate x_std value (if any) to the compiler option(s) (if any). + // config.x.std overrides x.std // - tstd = translate_std (ci, rs, cast_null<string> (rs[x_std])); + { + lookup l (config::omitted (rs, config_x_std).first); + + const string* v; + if (l.defined ()) + { + v = cast_null<string> (l); + rs.assign (x_std) = v; + } + else + v = cast_null<string> (rs[x_std]); + + // Translate x_std value (if any) to the compiler option(s) (if any). + // + tstd = translate_std (ci, rs, v); + } // Extract system header/library search paths from the compiler and // determine if we need any additional search paths. |