diff options
author | Brad King <brad.king@kitware.com> | 2021-03-04 18:10:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-05 14:34:58 (GMT) |
commit | fe17685722f7c4af3664409f1728f7c3e9e4e9da (patch) | |
tree | 5753117263140dd1164c0d006c334dec2c355d59 | |
parent | 15610d42fee8d2a6db1ad4be0d681be7f7f178c9 (diff) | |
download | CMake-fe17685722f7c4af3664409f1728f7c3e9e4e9da.zip CMake-fe17685722f7c4af3664409f1728f7c3e9e4e9da.tar.gz CMake-fe17685722f7c4af3664409f1728f7c3e9e4e9da.tar.bz2 |
cmGlobalVisualStudio10Generator: Adopt flag table name methods
Migrate them from `cmVisualStudio10ToolsetOptions`.
-rw-r--r-- | Source/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 188 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 17 | ||||
-rw-r--r-- | Source/cmVisualStudio10ToolsetOptions.cxx | 143 | ||||
-rw-r--r-- | Source/cmVisualStudio10ToolsetOptions.h | 31 |
5 files changed, 177 insertions, 204 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6adc9cf..d782890 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -785,8 +785,6 @@ if (WIN32) cmVisualStudioGeneratorOptions.cxx cmVisualStudio10TargetGenerator.h cmVisualStudio10TargetGenerator.cxx - cmVisualStudio10ToolsetOptions.h - cmVisualStudio10ToolsetOptions.cxx cmLocalVisualStudio10Generator.cxx cmLocalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.h diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7794df3..8ad6f5d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1400,65 +1400,65 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable( cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetClFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetClFlagTableName( + std::string optionsName = this->GetClFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( - this->GetPlatformName(), this->DefaultCLFlagTableName); + std::string defaultName = this->GetToolsetName(this->GetPlatformName(), + this->DefaultCLFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "CL"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCSharpFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetCSharpFlagTableName( + std::string optionsName = this->GetCSharpFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultCSharpFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "CSharp"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetRcFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetRcFlagTableName( + std::string optionsName = this->GetRcFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( - this->GetPlatformName(), this->DefaultRCFlagTableName); + std::string defaultName = this->GetToolsetName(this->GetPlatformName(), + this->DefaultRCFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "RC"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLibFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetLibFlagTableName( + std::string optionsName = this->GetLibFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultLibFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "LIB"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetLinkFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetLinkFlagTableName( + std::string optionsName = this->GetLinkFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultLinkFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "Link"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaFlagTable() const { - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultCudaFlagTableName); return LoadFlagTable("", toolsetName, defaultName, "Cuda"); } @@ -1466,29 +1466,165 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaFlagTable() const cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetCudaHostFlagTable() const { - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultCudaHostFlagTableName); return LoadFlagTable("", toolsetName, defaultName, "CudaHost"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetMasmFlagTable() const { - std::string optionsName = this->ToolsetOptions.GetMasmFlagTableName( + std::string optionsName = this->GetMasmFlagTableName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultMasmFlagTableName); return LoadFlagTable(optionsName, toolsetName, defaultName, "MASM"); } cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const { - std::string toolsetName = this->ToolsetOptions.GetToolsetName( + std::string toolsetName = this->GetToolsetName( this->GetPlatformName(), this->GetPlatformToolsetString()); - std::string defaultName = this->ToolsetOptions.GetToolsetName( + std::string defaultName = this->GetToolsetName( this->GetPlatformName(), this->DefaultNasmFlagTableName); return LoadFlagTable("", toolsetName, defaultName, "NASM"); } + +std::string cmGlobalVisualStudio10Generator::GetClFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if (toolset == "v142") { + return "v142"; + } else if (toolset == "v141") { + return "v141"; + } else if (useToolset == "v140") { + return "v140"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if (useToolset == "v142") { + return "v142"; + } else if (useToolset == "v141") { + return "v141"; + } else if (useToolset == "v140") { + return "v140"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { + return "v14"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { + return "v14"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if (useToolset == "v142") { + return "v142"; + } else if (useToolset == "v141") { + return "v141"; + } else if (useToolset == "v140") { + return "v140"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName( + std::string const& name, std::string const& toolset) const +{ + std::string const useToolset = this->GetToolsetName(name, toolset); + + if ((useToolset == "v140") || (useToolset == "v141") || + (useToolset == "v142")) { + return "v14"; + } else if (useToolset == "v120") { + return "v12"; + } else if (useToolset == "v110") { + return "v11"; + } else if (useToolset == "v100") { + return "v10"; + } else { + return ""; + } +} + +std::string cmGlobalVisualStudio10Generator::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); +} diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 65ea33f..64a7b95 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -6,7 +6,6 @@ #include <set> #include "cmGlobalVisualStudio8Generator.h" -#include "cmVisualStudio10ToolsetOptions.h" /** \class cmGlobalVisualStudio10Generator * \brief Write a Unix makefiles. @@ -224,7 +223,6 @@ private: std::string MSBuildCommand; bool MSBuildCommandInitialized; - cmVisualStudio10ToolsetOptions ToolsetOptions; std::set<std::string> AndroidExecutableWarnings; virtual std::string FindMSBuildCommand(); std::string FindDevEnvCommand() override; @@ -234,6 +232,21 @@ private: bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); + std::string GetClFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetCSharpFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetRcFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetLibFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetLinkFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetMasmFlagTableName(std::string const& name, + std::string const& toolset) const; + std::string GetToolsetName(std::string const& name, + std::string const& toolset) const; + std::string CustomVCTargetsPath; std::string VCTargetsPath; bool FindVCTargetsPath(cmMakefile* mf); diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx deleted file mode 100644 index 7fc33e6..0000000 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/* 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" - -std::string cmVisualStudio10ToolsetOptions::GetClFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if (toolset == "v142") { - return "v142"; - } else if (toolset == "v141") { - return "v141"; - } else if (useToolset == "v140") { - return "v140"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if (useToolset == "v142") { - return "v142"; - } else if (useToolset == "v141") { - return "v141"; - } else if (useToolset == "v140") { - return "v140"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -std::string cmVisualStudio10ToolsetOptions::GetRcFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { - return "v14"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -std::string cmVisualStudio10ToolsetOptions::GetLibFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { - return "v14"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -std::string cmVisualStudio10ToolsetOptions::GetLinkFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if (useToolset == "v142") { - return "v142"; - } else if (useToolset == "v141") { - return "v141"; - } else if (useToolset == "v140") { - return "v140"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -std::string cmVisualStudio10ToolsetOptions::GetMasmFlagTableName( - std::string const& name, std::string const& toolset) const -{ - std::string const useToolset = this->GetToolsetName(name, toolset); - - if ((useToolset == "v140") || (useToolset == "v141") || - (useToolset == "v142")) { - return "v14"; - } else if (useToolset == "v120") { - return "v12"; - } else if (useToolset == "v110") { - return "v11"; - } else if (useToolset == "v100") { - return "v10"; - } else { - return ""; - } -} - -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); -} diff --git a/Source/cmVisualStudio10ToolsetOptions.h b/Source/cmVisualStudio10ToolsetOptions.h deleted file mode 100644 index 85cc2b6..0000000 --- a/Source/cmVisualStudio10ToolsetOptions.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#pragma once - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <string> - -/** \class cmVisualStudio10ToolsetOptions - * \brief Retrieves toolset options for MSBuild. - * - * cmVisualStudio10ToolsetOptions manages toolsets within MSBuild - */ -class cmVisualStudio10ToolsetOptions -{ -public: - std::string GetClFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetCSharpFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetRcFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetLibFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetLinkFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetMasmFlagTableName(std::string const& name, - std::string const& toolset) const; - std::string GetToolsetName(std::string const& name, - std::string const& toolset) const; -}; |