aboutsummaryrefslogtreecommitdiff
path: root/build/cxx/utility.txx
blob: 7d9d68688628b2330eb02c34b5a2a11164f03d26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// file      : build/cxx/utility.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

using namespace std;

namespace build
{
  namespace cxx
  {
    template <typename T>
    void
    append_std (cstrings& args, T& t, std::string& s)
    {
      if (auto val = t["cxx.std"])
      {
        const std::string& v (val.template as<const string&> ());

        // Translate 11 to 0x and 14 to 1y for compatibility with
        // older versions of the compiler.
        //
        s = "-std=c++";

        if (v == "11")
          s += "0x";
        else if (v == "14")
          s += "1y";
        else
          s += v;

        args.push_back (s.c_str ());
      }
    }
  }
}