cmVisualStudio10ToolsetOptions.cxx 3.73 KB
Newer Older
1
2
3
4
5
6
7
8
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */
#include "cmVisualStudio10ToolsetOptions.h"

#include "cmAlgorithms.h"
#include "cmIDEFlagTable.h"
#include "cmVisualStudioGeneratorOptions.h"

9
std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName(
10
  std::string const& name, std::string const& toolset) const
11
12
13
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

14
15
16
  if (toolset == "v142") {
    return "v142";
  } else if (toolset == "v141") {
17
    return "v141";
18
  } else if (useToolset == "v140") {
19
    return "v140";
20
  } else if (useToolset == "v120") {
21
    return "v12";
22
  } else if (useToolset == "v110") {
23
    return "v11";
24
  } else if (useToolset == "v100") {
25
    return "v10";
26
  } else {
27
    return "";
28
29
30
  }
}

31
std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName(
32
  std::string const& name, std::string const& toolset) const
Michael Stürmer's avatar
Michael Stürmer committed
33
34
35
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

36
37
38
39
  if (useToolset == "v142") {
    // FIXME: Add CSharp flag table for v142.
    return "v141";
  } else if (useToolset == "v141") {
40
    return "v141";
Michael Stürmer's avatar
Michael Stürmer committed
41
  } else if (useToolset == "v140") {
42
    return "v140";
Michael Stürmer's avatar
Michael Stürmer committed
43
  } else if (useToolset == "v120") {
44
    return "v12";
Michael Stürmer's avatar
Michael Stürmer committed
45
  } else if (useToolset == "v110") {
46
    return "v11";
Michael Stürmer's avatar
Michael Stürmer committed
47
  } else if (useToolset == "v100") {
48
    return "v10";
Michael Stürmer's avatar
Michael Stürmer committed
49
  } else {
50
    return "";
Michael Stürmer's avatar
Michael Stürmer committed
51
52
53
  }
}

54
std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName(
55
  std::string const& name, std::string const& toolset) const
56
57
58
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

59
60
  if ((useToolset == "v140") || (useToolset == "v141") ||
      (useToolset == "v142")) {
61
    return "v14";
62
  } else if (useToolset == "v120") {
63
    return "v12";
64
  } else if (useToolset == "v110") {
65
    return "v11";
66
  } else if (useToolset == "v100") {
67
    return "v10";
68
  } else {
69
    return "";
70
71
72
  }
}

73
std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName(
74
  std::string const& name, std::string const& toolset) const
75
76
77
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

78
79
  if ((useToolset == "v140") || (useToolset == "v141") ||
      (useToolset == "v142")) {
80
    return "v14";
81
  } else if (useToolset == "v120") {
82
    return "v12";
83
  } else if (useToolset == "v110") {
84
    return "v11";
85
  } else if (useToolset == "v100") {
86
    return "v10";
87
  } else {
88
    return "";
89
90
91
  }
}

92
std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName(
93
  std::string const& name, std::string const& toolset) const
94
95
96
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

97
98
99
  if (useToolset == "v142") {
    return "v142";
  } else if (useToolset == "v141") {
100
    return "v141";
101
  } else if (useToolset == "v140") {
102
    return "v140";
103
  } else if (useToolset == "v120") {
104
    return "v12";
105
  } else if (useToolset == "v110") {
106
    return "v11";
107
  } else if (useToolset == "v100") {
108
    return "v10";
109
  } else {
110
    return "";
111
112
113
  }
}

114
std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName(
115
  std::string const& name, std::string const& toolset) const
116
117
118
{
  std::string const useToolset = this->GetToolsetName(name, toolset);

119
120
  if ((useToolset == "v140") || (useToolset == "v141") ||
      (useToolset == "v142")) {
121
    return "v14";
122
  } else if (useToolset == "v120") {
123
    return "v12";
124
  } else if (useToolset == "v110") {
125
    return "v11";
126
  } else if (useToolset == "v100") {
127
    return "v10";
128
  } else {
129
    return "";
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
  }
}

std::string cmVisualStudio10ToolsetOptions::GetToolsetName(
  std::string const& name, std::string const& toolset) const
{
  static_cast<void>(name);
  std::size_t length = toolset.length();

  if (cmHasLiteralSuffix(toolset, "_xp")) {
    length -= 3;
  }

  return toolset.substr(0, length);
}