cmVisualStudio10ToolsetOptions.cxx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmVisualStudio10ToolsetOptions.h"
  4. #include "cmAlgorithms.h"
  5. #include "cmIDEFlagTable.h"
  6. #include "cmVisualStudioGeneratorOptions.h"
  7. std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName(
  8. std::string const& name, std::string const& toolset) const
  9. {
  10. std::string const useToolset = this->GetToolsetName(name, toolset);
  11. if (toolset == "v142") {
  12. return "v142";
  13. } else if (toolset == "v141") {
  14. return "v141";
  15. } else if (useToolset == "v140") {
  16. return "v140";
  17. } else if (useToolset == "v120") {
  18. return "v12";
  19. } else if (useToolset == "v110") {
  20. return "v11";
  21. } else if (useToolset == "v100") {
  22. return "v10";
  23. } else {
  24. return "";
  25. }
  26. }
  27. std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName(
  28. std::string const& name, std::string const& toolset) const
  29. {
  30. std::string const useToolset = this->GetToolsetName(name, toolset);
  31. if (useToolset == "v142") {
  32. return "v142";
  33. } else if (useToolset == "v141") {
  34. return "v141";
  35. } else if (useToolset == "v140") {
  36. return "v140";
  37. } else if (useToolset == "v120") {
  38. return "v12";
  39. } else if (useToolset == "v110") {
  40. return "v11";
  41. } else if (useToolset == "v100") {
  42. return "v10";
  43. } else {
  44. return "";
  45. }
  46. }
  47. std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName(
  48. std::string const& name, std::string const& toolset) const
  49. {
  50. std::string const useToolset = this->GetToolsetName(name, toolset);
  51. if ((useToolset == "v140") || (useToolset == "v141") ||
  52. (useToolset == "v142")) {
  53. return "v14";
  54. } else if (useToolset == "v120") {
  55. return "v12";
  56. } else if (useToolset == "v110") {
  57. return "v11";
  58. } else if (useToolset == "v100") {
  59. return "v10";
  60. } else {
  61. return "";
  62. }
  63. }
  64. std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName(
  65. std::string const& name, std::string const& toolset) const
  66. {
  67. std::string const useToolset = this->GetToolsetName(name, toolset);
  68. if ((useToolset == "v140") || (useToolset == "v141") ||
  69. (useToolset == "v142")) {
  70. return "v14";
  71. } else if (useToolset == "v120") {
  72. return "v12";
  73. } else if (useToolset == "v110") {
  74. return "v11";
  75. } else if (useToolset == "v100") {
  76. return "v10";
  77. } else {
  78. return "";
  79. }
  80. }
  81. std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName(
  82. std::string const& name, std::string const& toolset) const
  83. {
  84. std::string const useToolset = this->GetToolsetName(name, toolset);
  85. if (useToolset == "v142") {
  86. return "v142";
  87. } else if (useToolset == "v141") {
  88. return "v141";
  89. } else if (useToolset == "v140") {
  90. return "v140";
  91. } else if (useToolset == "v120") {
  92. return "v12";
  93. } else if (useToolset == "v110") {
  94. return "v11";
  95. } else if (useToolset == "v100") {
  96. return "v10";
  97. } else {
  98. return "";
  99. }
  100. }
  101. std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName(
  102. std::string const& name, std::string const& toolset) const
  103. {
  104. std::string const useToolset = this->GetToolsetName(name, toolset);
  105. if ((useToolset == "v140") || (useToolset == "v141") ||
  106. (useToolset == "v142")) {
  107. return "v14";
  108. } else if (useToolset == "v120") {
  109. return "v12";
  110. } else if (useToolset == "v110") {
  111. return "v11";
  112. } else if (useToolset == "v100") {
  113. return "v10";
  114. } else {
  115. return "";
  116. }
  117. }
  118. std::string cmVisualStudio10ToolsetOptions::GetToolsetName(
  119. std::string const& name, std::string const& toolset) const
  120. {
  121. static_cast<void>(name);
  122. std::size_t length = toolset.length();
  123. if (cmHasLiteralSuffix(toolset, "_xp")) {
  124. length -= 3;
  125. }
  126. return toolset.substr(0, length);
  127. }