|
|
@@ -9,6 +9,7 @@
|
|
|
#include <utility>
|
|
|
|
|
|
#include <cm/memory>
|
|
|
+#include <cmext/string_view>
|
|
|
|
|
|
#include <cm3p/json/reader.h>
|
|
|
#include <cm3p/json/value.h>
|
|
|
@@ -83,10 +84,10 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
{
|
|
|
if (this->SystemIsWindowsCE && ts.empty() &&
|
|
|
this->DefaultPlatformToolset.empty()) {
|
|
|
- std::ostringstream e;
|
|
|
- e << this->GetName() << " Windows CE version '" << this->SystemVersion
|
|
|
- << "' requires CMAKE_GENERATOR_TOOLSET to be set.";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat(this->GetName(), " Windows CE version '", this->SystemVersion,
|
|
|
+ "' requires CMAKE_GENERATOR_TOOLSET to be set."));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -105,16 +106,17 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
if (!this->CustomFlagTableDir.empty() &&
|
|
|
!(cmSystemTools::FileIsFullPath(this->CustomFlagTableDir) &&
|
|
|
cmSystemTools::FileIsDirectory(this->CustomFlagTableDir))) {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset\n"
|
|
|
- " customFlagTableDir=" << this->CustomFlagTableDir << "\n"
|
|
|
- "that is not an absolute path to an existing directory.";
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset\n"
|
|
|
+ " customFlagTableDir=",
|
|
|
+ this->CustomFlagTableDir,
|
|
|
+ "\n"
|
|
|
+ "that is not an absolute path to an existing directory."));
|
|
|
cmSystemTools::SetFatalErrorOccurred();
|
|
|
return false;
|
|
|
}
|
|
|
@@ -125,7 +127,8 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
// differing from the "false" and "true" values used in older toolsets.
|
|
|
// A VS 2015 update changed it back. Parse the "link.xml" file to
|
|
|
// discover which one we need.
|
|
|
- std::string const link_xml = this->VCTargetsPath + "/1033/link.xml";
|
|
|
+ std::string const link_xml =
|
|
|
+ cmStrCat(this->VCTargetsPath, "/1033/link.xml");
|
|
|
cmsys::ifstream fin(link_xml.c_str());
|
|
|
std::string line;
|
|
|
while (fin && cmSystemTools::GetLineFromStream(fin, line)) {
|
|
|
@@ -140,24 +143,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
this->SupportsUnityBuilds =
|
|
|
this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 ||
|
|
|
(this->Version == cmGlobalVisualStudioGenerator::VSVersion::VS15 &&
|
|
|
- cmSystemTools::PathExists(this->VCTargetsPath +
|
|
|
- "/Microsoft.Cpp.Unity.targets"));
|
|
|
+ cmSystemTools::PathExists(
|
|
|
+ cmStrCat(this->VCTargetsPath, "/Microsoft.Cpp.Unity.targets")));
|
|
|
|
|
|
if (this->GeneratorToolsetCuda.empty()) {
|
|
|
// Find the highest available version of the CUDA tools.
|
|
|
std::vector<std::string> cudaTools;
|
|
|
std::string bcDir;
|
|
|
if (this->GeneratorToolsetCudaCustomDir.empty()) {
|
|
|
- bcDir = this->VCTargetsPath + "/BuildCustomizations";
|
|
|
+ bcDir = cmStrCat(this->VCTargetsPath, "/BuildCustomizations");
|
|
|
} else {
|
|
|
- bcDir = this->GetPlatformToolsetCudaCustomDirString() +
|
|
|
- this->GetPlatformToolsetCudaVSIntegrationSubdirString() +
|
|
|
- "extras\\visual_studio_integration\\MSBuildExtensions";
|
|
|
+ bcDir = cmStrCat(this->GetPlatformToolsetCudaCustomDirString(),
|
|
|
+ this->GetPlatformToolsetCudaVSIntegrationSubdirString(),
|
|
|
+ "extras\\visual_studio_integration\\MSBuildExtensions");
|
|
|
cmSystemTools::ConvertToUnixSlashes(bcDir);
|
|
|
}
|
|
|
cmsys::Glob gl;
|
|
|
gl.SetRelative(bcDir.c_str());
|
|
|
- if (gl.FindFiles(bcDir + "/CUDA *.props")) {
|
|
|
+ if (gl.FindFiles(cmStrCat(bcDir, "/CUDA *.props"))) {
|
|
|
cudaTools = gl.GetFiles();
|
|
|
}
|
|
|
if (!cudaTools.empty()) {
|
|
|
@@ -168,18 +171,19 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
} else if (!this->GeneratorToolsetCudaCustomDir.empty()) {
|
|
|
// Generate an error if Visual Studio integration files are not found
|
|
|
// inside of custom cuda toolset.
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset\n"
|
|
|
- " cuda=" << this->GeneratorToolsetCudaCustomDir << "\n"
|
|
|
- "cannot detect Visual Studio integration files in path\n"
|
|
|
- " " << bcDir;
|
|
|
-
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset\n"
|
|
|
+ " cuda=",
|
|
|
+ this->GeneratorToolsetCudaCustomDir,
|
|
|
+ "\n"
|
|
|
+ "cannot detect Visual Studio integration files in path\n"
|
|
|
+ " ",
|
|
|
+ bcDir));
|
|
|
|
|
|
// Clear the configured tool-set
|
|
|
this->GeneratorToolsetCuda.clear();
|
|
|
@@ -187,32 +191,31 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
}
|
|
|
|
|
|
if (!this->GeneratorToolsetVersion.empty() &&
|
|
|
- this->GeneratorToolsetVersion != "Test Toolset Version") {
|
|
|
+ this->GeneratorToolsetVersion != "Test Toolset Version"_s) {
|
|
|
// If a specific minor version of the toolset was requested, verify that it
|
|
|
// is compatible to the major version and that is exists on disk.
|
|
|
// If not clear the value.
|
|
|
std::string versionToolset = this->GeneratorToolsetVersion;
|
|
|
cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]");
|
|
|
if (regex.find(versionToolset)) {
|
|
|
- versionToolset = "v" + versionToolset.erase(2, 1);
|
|
|
+ versionToolset = cmStrCat('v', versionToolset.erase(2, 1));
|
|
|
} else {
|
|
|
// Version not recognized. Clear it.
|
|
|
versionToolset.clear();
|
|
|
}
|
|
|
|
|
|
if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset and version specification\n"
|
|
|
- " " << this->GetPlatformToolsetString() << ",version=" <<
|
|
|
- this->GeneratorToolsetVersion << "\n"
|
|
|
- "contains an invalid version specification."
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset and version specification\n"
|
|
|
+ " ",
|
|
|
+ this->GetPlatformToolsetString(),
|
|
|
+ ",version=", this->GeneratorToolsetVersion,
|
|
|
+ "\n"
|
|
|
+ "contains an invalid version specification."));
|
|
|
|
|
|
// Clear the configured tool-set
|
|
|
this->GeneratorToolsetVersion.clear();
|
|
|
@@ -232,40 +235,40 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|
|
this->GeneratorToolsetVersionProps = std::move(auxProps);
|
|
|
break;
|
|
|
case AuxToolset::PropsMissing: {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset and version specification\n"
|
|
|
- " " << this->GetPlatformToolsetString() << ",version=" <<
|
|
|
- this->GeneratorToolsetVersion << "\n"
|
|
|
- "does not seem to be installed at\n" <<
|
|
|
- " " << auxProps;
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset and version specification\n"
|
|
|
+ " ",
|
|
|
+ this->GetPlatformToolsetString(),
|
|
|
+ ",version=", this->GeneratorToolsetVersion,
|
|
|
+ "\n"
|
|
|
+ "does not seem to be installed at\n"
|
|
|
+ " ",
|
|
|
+ auxProps));
|
|
|
|
|
|
// Clear the configured tool-set
|
|
|
this->GeneratorToolsetVersion.clear();
|
|
|
this->GeneratorToolsetVersionProps = {};
|
|
|
} break;
|
|
|
case AuxToolset::PropsIndeterminate: {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset and version specification\n"
|
|
|
- " " << this->GetPlatformToolsetString() << ",version=" <<
|
|
|
- this->GeneratorToolsetVersion << "\n"
|
|
|
- "has multiple matches installed at\n" <<
|
|
|
- " " << auxProps << "\n" <<
|
|
|
- "The toolset and version specification must resolve \n" <<
|
|
|
- "to a single installed toolset";
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset and version specification\n"
|
|
|
+ " ",
|
|
|
+ this->GetPlatformToolsetString(),
|
|
|
+ ",version=", this->GeneratorToolsetVersion,
|
|
|
+ "\n"
|
|
|
+ "has multiple matches installed at\n",
|
|
|
+ " ", auxProps, "\n",
|
|
|
+ "The toolset and version specification must resolve \n"
|
|
|
+ "to a single installed toolset"));
|
|
|
|
|
|
// Clear the configured tool-set
|
|
|
this->GeneratorToolsetVersion.clear();
|
|
|
@@ -319,47 +322,47 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
|
|
|
for (; fi != fields.end(); ++fi) {
|
|
|
std::string::size_type pos = fi->find('=');
|
|
|
if (pos == fi->npos) {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset specification\n"
|
|
|
- " " << ts << "\n"
|
|
|
- "that contains a field after the first ',' with no '='."
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset specification\n"
|
|
|
+ " ",
|
|
|
+ ts,
|
|
|
+ "\n"
|
|
|
+ "that contains a field after the first ',' with no '='."));
|
|
|
return false;
|
|
|
}
|
|
|
std::string const key = fi->substr(0, pos);
|
|
|
std::string const value = fi->substr(pos + 1);
|
|
|
if (!handled.insert(key).second) {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset specification\n"
|
|
|
- " " << ts << "\n"
|
|
|
- "that contains duplicate field key '" << key << "'."
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset specification\n"
|
|
|
+ " ",
|
|
|
+ ts,
|
|
|
+ "\n"
|
|
|
+ "that contains duplicate field key '",
|
|
|
+ key, "'."));
|
|
|
return false;
|
|
|
}
|
|
|
if (!this->ProcessGeneratorToolsetField(key, value)) {
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "Generator\n"
|
|
|
- " " << this->GetName() << "\n"
|
|
|
- "given toolset specification\n"
|
|
|
- " " << ts << "\n"
|
|
|
- "that contains invalid field '" << *fi << "'."
|
|
|
- ;
|
|
|
- /* clang-format on */
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Generator\n"
|
|
|
+ " ",
|
|
|
+ this->GetName(),
|
|
|
+ "\n"
|
|
|
+ "given toolset specification\n"
|
|
|
+ " ",
|
|
|
+ ts,
|
|
|
+ "\n"
|
|
|
+ "that contains invalid field '",
|
|
|
+ *fi, "'."));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -370,7 +373,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
|
|
|
bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField(
|
|
|
std::string const& key, std::string const& value)
|
|
|
{
|
|
|
- if (key == "cuda") {
|
|
|
+ if (key == "cuda"_s) {
|
|
|
/* test if cuda toolset is path to custom dir or cuda version */
|
|
|
auto pos = value.find_first_not_of("0123456789.");
|
|
|
if (pos != std::string::npos) {
|
|
|
@@ -395,16 +398,16 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField(
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
- if (key == "customFlagTableDir") {
|
|
|
+ if (key == "customFlagTableDir"_s) {
|
|
|
this->CustomFlagTableDir = value;
|
|
|
cmSystemTools::ConvertToUnixSlashes(this->CustomFlagTableDir);
|
|
|
return true;
|
|
|
}
|
|
|
- if (key == "version") {
|
|
|
+ if (key == "version"_s) {
|
|
|
this->GeneratorToolsetVersion = value;
|
|
|
return true;
|
|
|
}
|
|
|
- if (key == "VCTargetsPath") {
|
|
|
+ if (key == "VCTargetsPath"_s) {
|
|
|
this->CustomVCTargetsPath = value;
|
|
|
ConvertToWindowsSlashes(this->CustomVCTargetsPath);
|
|
|
return true;
|
|
|
@@ -414,34 +417,35 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField(
|
|
|
|
|
|
bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
|
|
|
{
|
|
|
- if (this->SystemName == "Windows") {
|
|
|
+ if (this->SystemName == "Windows"_s) {
|
|
|
if (!this->InitializeWindows(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
- } else if (this->SystemName == "WindowsCE") {
|
|
|
+ } else if (this->SystemName == "WindowsCE"_s) {
|
|
|
this->SystemIsWindowsCE = true;
|
|
|
if (!this->InitializeWindowsCE(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
- } else if (this->SystemName == "WindowsPhone") {
|
|
|
+ } else if (this->SystemName == "WindowsPhone"_s) {
|
|
|
this->SystemIsWindowsPhone = true;
|
|
|
if (!this->InitializeWindowsPhone(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
- } else if (this->SystemName == "WindowsStore") {
|
|
|
+ } else if (this->SystemName == "WindowsStore"_s) {
|
|
|
this->SystemIsWindowsStore = true;
|
|
|
if (!this->InitializeWindowsStore(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
- } else if (this->SystemName == "Android") {
|
|
|
+ } else if (this->SystemName == "Android"_s) {
|
|
|
if (this->PlatformInGeneratorName) {
|
|
|
- std::ostringstream e;
|
|
|
- e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR "
|
|
|
- << "specifies a platform too: '" << this->GetName() << "'";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ",
|
|
|
+ "specifies a platform too: '", this->GetName(), '\''));
|
|
|
return false;
|
|
|
}
|
|
|
- if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") == "Tegra-Android") {
|
|
|
+ if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") ==
|
|
|
+ "Tegra-Android"_s) {
|
|
|
if (!this->InitializeTegraAndroid(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -464,10 +468,10 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*)
|
|
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
|
|
|
{
|
|
|
if (this->PlatformInGeneratorName) {
|
|
|
- std::ostringstream e;
|
|
|
- e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
|
|
|
- << "specifies a platform too: '" << this->GetName() << "'";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ",
|
|
|
+ "specifies a platform too: '", this->GetName(), '\''));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -485,17 +489,17 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
|
|
|
|
|
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
|
|
|
{
|
|
|
- std::ostringstream e;
|
|
|
- e << this->GetName() << " does not support Windows Phone.";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat(this->GetName(), " does not support Windows Phone."));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
|
|
|
{
|
|
|
- std::ostringstream e;
|
|
|
- e << this->GetName() << " does not support Windows Store.";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(
|
|
|
+ MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat(this->GetName(), " does not support Windows Store."));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -519,15 +523,15 @@ bool cmGlobalVisualStudio10Generator::InitializeTegraAndroid(cmMakefile* mf)
|
|
|
|
|
|
bool cmGlobalVisualStudio10Generator::InitializeAndroid(cmMakefile* mf)
|
|
|
{
|
|
|
- std::ostringstream e;
|
|
|
- e << this->GetName() << " does not support Android.";
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat(this->GetName(), " does not support Android."));
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
bool cmGlobalVisualStudio10Generator::InitializePlatform(cmMakefile* mf)
|
|
|
{
|
|
|
- if (this->SystemName == "Windows" || this->SystemName == "WindowsStore") {
|
|
|
+ if (this->SystemName == "Windows"_s ||
|
|
|
+ this->SystemName == "WindowsStore"_s) {
|
|
|
if (!this->InitializePlatformWindows(mf)) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -565,7 +569,7 @@ bool cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
|
|
|
|
|
|
std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
|
|
|
{
|
|
|
- if (this->SystemVersion == "8.0") {
|
|
|
+ if (this->SystemVersion == "8.0"_s) {
|
|
|
return "CE800";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -607,29 +611,30 @@ void cmGlobalVisualStudio10Generator::Generate()
|
|
|
}
|
|
|
if (this->LongestSource.Length > 0) {
|
|
|
cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
|
|
|
- std::ostringstream e;
|
|
|
- /* clang-format off */
|
|
|
- e <<
|
|
|
- "The binary and/or source directory paths may be too long to generate "
|
|
|
- "Visual Studio 10 files for this project. "
|
|
|
- "Consider choosing shorter directory names to build this project with "
|
|
|
- "Visual Studio 10. "
|
|
|
- "A more detailed explanation follows."
|
|
|
- "\n"
|
|
|
- "There is a bug in the VS 10 IDE that renders property dialog fields "
|
|
|
- "blank for files referenced by full path in the project file. "
|
|
|
- "However, CMake must reference at least one file by full path:\n"
|
|
|
- " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
|
|
|
- "This is because some Visual Studio tools would append the relative "
|
|
|
- "path to the end of the referencing directory path, as in:\n"
|
|
|
- " " << lg->GetCurrentBinaryDirectory() << "/"
|
|
|
- << this->LongestSource.SourceRel << "\n"
|
|
|
- "and then incorrectly complain that the file does not exist because "
|
|
|
- "the path length is too long for some internal buffer or API. "
|
|
|
- "To avoid this problem CMake must use a full path for this file "
|
|
|
- "which then triggers the VS 10 property dialog bug.";
|
|
|
- /* clang-format on */
|
|
|
- lg->IssueMessage(MessageType::WARNING, e.str());
|
|
|
+ lg->IssueMessage(
|
|
|
+ MessageType::WARNING,
|
|
|
+ cmStrCat(
|
|
|
+ "The binary and/or source directory paths may be too long to generate "
|
|
|
+ "Visual Studio 10 files for this project. "
|
|
|
+ "Consider choosing shorter directory names to build this project with "
|
|
|
+ "Visual Studio 10. "
|
|
|
+ "A more detailed explanation follows."
|
|
|
+ "\n"
|
|
|
+ "There is a bug in the VS 10 IDE that renders property dialog fields "
|
|
|
+ "blank for files referenced by full path in the project file. "
|
|
|
+ "However, CMake must reference at least one file by full path:\n"
|
|
|
+ " ",
|
|
|
+ this->LongestSource.SourceFile->GetFullPath(),
|
|
|
+ "\n"
|
|
|
+ "This is because some Visual Studio tools would append the relative "
|
|
|
+ "path to the end of the referencing directory path, as in:\n"
|
|
|
+ " ",
|
|
|
+ lg->GetCurrentBinaryDirectory(), '/', this->LongestSource.SourceRel,
|
|
|
+ "\n"
|
|
|
+ "and then incorrectly complain that the file does not exist because "
|
|
|
+ "the path length is too long for some internal buffer or API. "
|
|
|
+ "To avoid this problem CMake must use a full path for this file "
|
|
|
+ "which then triggers the VS 10 property dialog bug."));
|
|
|
}
|
|
|
if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue(
|
|
|
"CMAKE_VS_NUGET_PACKAGE_RESTORE")) {
|
|
|
@@ -641,10 +646,10 @@ void cmGlobalVisualStudio10Generator::EnableLanguage(
|
|
|
std::vector<std::string> const& lang, cmMakefile* mf, bool optional)
|
|
|
{
|
|
|
for (std::string const& it : lang) {
|
|
|
- if (it == "ASM_NASM") {
|
|
|
+ if (it == "ASM_NASM"_s) {
|
|
|
this->NasmEnabled = true;
|
|
|
}
|
|
|
- if (it == "CUDA") {
|
|
|
+ if (it == "CUDA"_s) {
|
|
|
this->CudaEnabled = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -830,8 +835,8 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
|
|
|
bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
{
|
|
|
// Skip this in special cases within our own test suite.
|
|
|
- if (this->GetPlatformName() == "Test Platform" ||
|
|
|
- this->GetPlatformToolsetString() == "Test Toolset") {
|
|
|
+ if (this->GetPlatformName() == "Test Platform"_s ||
|
|
|
+ this->GetPlatformToolsetString() == "Test Toolset"_s) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -843,11 +848,11 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
wd = cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(),
|
|
|
"/CMakeFiles");
|
|
|
}
|
|
|
- wd += "/";
|
|
|
+ wd += '/';
|
|
|
wd += cmVersion::GetCMakeVersion();
|
|
|
|
|
|
// We record the result persistently in a file.
|
|
|
- std::string const txt = wd + "/VCTargetsPath.txt";
|
|
|
+ std::string const txt = cmStrCat(wd, "/VCTargetsPath.txt");
|
|
|
|
|
|
// If we have a recorded result, use it.
|
|
|
{
|
|
|
@@ -861,8 +866,8 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
|
|
|
// Prepare the work directory.
|
|
|
if (!cmSystemTools::MakeDirectory(wd)) {
|
|
|
- std::string e = "Failed to make directory:\n " + wd;
|
|
|
- mf->IssueMessage(MessageType::FATAL_ERROR, e);
|
|
|
+ mf->IssueMessage(MessageType::FATAL_ERROR,
|
|
|
+ cmStrCat("Failed to make directory:\n ", wd));
|
|
|
cmSystemTools::SetFatalErrorOccurred();
|
|
|
return false;
|
|
|
}
|
|
|
@@ -870,7 +875,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
// Generate a project file for MSBuild to tell us the VCTargetsPath value.
|
|
|
std::string const vcxproj = "VCTargetsPath.vcxproj";
|
|
|
{
|
|
|
- std::string const vcxprojAbs = wd + "/" + vcxproj;
|
|
|
+ std::string const vcxprojAbs = cmStrCat(wd, '/', vcxproj);
|
|
|
cmsys::ofstream fout(vcxprojAbs.c_str());
|
|
|
cmXMLWriter xw(fout);
|
|
|
|
|
|
@@ -889,7 +894,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
cmXMLElement eig(eprj, "ItemGroup");
|
|
|
eig.Attribute("Label", "ProjectConfigurations");
|
|
|
cmXMLElement epc(eig, "ProjectConfiguration");
|
|
|
- epc.Attribute("Include", "Debug|" + this->GetPlatformName());
|
|
|
+ epc.Attribute("Include", cmStrCat("Debug|", this->GetPlatformName()));
|
|
|
cmXMLElement(epc, "Configuration").Content("Debug");
|
|
|
cmXMLElement(epc, "Platform").Content(this->GetPlatformName());
|
|
|
}
|
|
|
@@ -899,19 +904,19 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
cmXMLElement(epg, "ProjectGuid")
|
|
|
.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}");
|
|
|
cmXMLElement(epg, "Keyword")
|
|
|
- .Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android"
|
|
|
+ .Content(mf->GetSafeDefinition("CMAKE_SYSTEM_NAME") == "Android"_s
|
|
|
? "Android"
|
|
|
: "Win32Proj");
|
|
|
cmXMLElement(epg, "Platform").Content(this->GetPlatformName());
|
|
|
- if (this->GetSystemName() == "WindowsPhone") {
|
|
|
+ if (this->GetSystemName() == "WindowsPhone"_s) {
|
|
|
cmXMLElement(epg, "ApplicationType").Content("Windows Phone");
|
|
|
cmXMLElement(epg, "ApplicationTypeRevision")
|
|
|
.Content(this->GetApplicationTypeRevision());
|
|
|
- } else if (this->GetSystemName() == "WindowsStore") {
|
|
|
+ } else if (this->GetSystemName() == "WindowsStore"_s) {
|
|
|
cmXMLElement(epg, "ApplicationType").Content("Windows Store");
|
|
|
cmXMLElement(epg, "ApplicationTypeRevision")
|
|
|
.Content(this->GetApplicationTypeRevision());
|
|
|
- } else if (this->GetSystemName() == "Android") {
|
|
|
+ } else if (this->GetSystemName() == "Android"_s) {
|
|
|
cmXMLElement(epg, "ApplicationType").Content("Android");
|
|
|
cmXMLElement(epg, "ApplicationTypeRevision")
|
|
|
.Content(this->GetApplicationTypeRevision());
|
|
|
@@ -920,10 +925,10 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
cmXMLElement(epg, "WindowsTargetPlatformVersion")
|
|
|
.Content(this->WindowsTargetPlatformVersion);
|
|
|
}
|
|
|
- if (this->GetSystemName() != "Android") {
|
|
|
- if (this->GetPlatformName() == "ARM64") {
|
|
|
+ if (this->GetSystemName() != "Android"_s) {
|
|
|
+ if (this->GetPlatformName() == "ARM64"_s) {
|
|
|
cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true");
|
|
|
- } else if (this->GetPlatformName() == "ARM") {
|
|
|
+ } else if (this->GetPlatformName() == "ARM"_s) {
|
|
|
cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true");
|
|
|
}
|
|
|
}
|
|
|
@@ -970,10 +975,9 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
|
|
std::vector<std::string> cmd;
|
|
|
cmd.push_back(this->GetMSBuildCommand());
|
|
|
cmd.push_back(vcxproj);
|
|
|
- cmd.push_back("/p:Configuration=Debug");
|
|
|
- cmd.push_back(cmStrCat("/p:Platform=", this->GetPlatformName()));
|
|
|
- cmd.push_back(std::string("/p:VisualStudioVersion=") +
|
|
|
- this->GetIDEVersion());
|
|
|
+ cmd.emplace_back("/p:Configuration=Debug");
|
|
|
+ cmd.emplace_back(cmStrCat("/p:Platform=", this->GetPlatformName()));
|
|
|
+ cmd.emplace_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion()));
|
|
|
std::string out;
|
|
|
int ret = 0;
|
|
|
cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]");
|
|
|
@@ -1049,7 +1053,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
|
|
break;
|
|
|
}
|
|
|
std::string proj = project.GetRelativePath();
|
|
|
- if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj") {
|
|
|
+ if (proj.size() > 7 && proj.substr(proj.size() - 7) == ".vfproj"_s) {
|
|
|
useDevEnv = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -1080,7 +1084,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
|
|
makeCommand.Add(makeProgramSelected);
|
|
|
cm::optional<cmSlnProjectEntry> proj = cm::nullopt;
|
|
|
|
|
|
- if (tname == "clean") {
|
|
|
+ if (tname == "clean"_s) {
|
|
|
makeCommand.Add(cmStrCat(projectName, ".sln"));
|
|
|
makeCommand.Add("/t:Clean");
|
|
|
} else {
|
|
|
@@ -1104,7 +1108,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
|
|
requiresRestore = false;
|
|
|
} else if (cmValue cached =
|
|
|
this->CMakeInstance->GetState()->GetCacheEntryValue(
|
|
|
- tname + "_REQUIRES_VS_PACKAGE_RESTORE")) {
|
|
|
+ cmStrCat(tname, "_REQUIRES_VS_PACKAGE_RESTORE"))) {
|
|
|
requiresRestore = cached.IsOn();
|
|
|
} else {
|
|
|
// There are no package references defined.
|
|
|
@@ -1164,7 +1168,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
|
|
std::string extension =
|
|
|
cmSystemTools::GetFilenameLastExtension(proj->GetRelativePath());
|
|
|
extension = cmSystemTools::LowerCase(extension);
|
|
|
- if (extension == ".csproj") {
|
|
|
+ if (extension == ".csproj"_s) {
|
|
|
// Use correct platform name
|
|
|
platform =
|
|
|
slnData.GetConfigurationTarget(tname, plainConfig, platform);
|
|
|
@@ -1271,7 +1275,7 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
|
|
|
|
|
|
std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const
|
|
|
{
|
|
|
- if (this->GetSystemName() == "Android") {
|
|
|
+ if (this->GetSystemName() == "Android"_s) {
|
|
|
return this->GetAndroidApplicationTypeRevision();
|
|
|
}
|
|
|
|
|
|
@@ -1302,23 +1306,23 @@ static unsigned int cmLoadFlagTableSpecial(Json::Value entry,
|
|
|
if (specials.isArray()) {
|
|
|
for (auto const& special : specials) {
|
|
|
std::string s = special.asString();
|
|
|
- if (s == "UserValue") {
|
|
|
+ if (s == "UserValue"_s) {
|
|
|
value |= cmIDEFlagTable::UserValue;
|
|
|
- } else if (s == "UserIgnored") {
|
|
|
+ } else if (s == "UserIgnored"_s) {
|
|
|
value |= cmIDEFlagTable::UserIgnored;
|
|
|
- } else if (s == "UserRequired") {
|
|
|
+ } else if (s == "UserRequired"_s) {
|
|
|
value |= cmIDEFlagTable::UserRequired;
|
|
|
- } else if (s == "Continue") {
|
|
|
+ } else if (s == "Continue"_s) {
|
|
|
value |= cmIDEFlagTable::Continue;
|
|
|
- } else if (s == "SemicolonAppendable") {
|
|
|
+ } else if (s == "SemicolonAppendable"_s) {
|
|
|
value |= cmIDEFlagTable::SemicolonAppendable;
|
|
|
- } else if (s == "UserFollowing") {
|
|
|
+ } else if (s == "UserFollowing"_s) {
|
|
|
value |= cmIDEFlagTable::UserFollowing;
|
|
|
- } else if (s == "CaseInsensitive") {
|
|
|
+ } else if (s == "CaseInsensitive"_s) {
|
|
|
value |= cmIDEFlagTable::CaseInsensitive;
|
|
|
- } else if (s == "SpaceAppendable") {
|
|
|
+ } else if (s == "SpaceAppendable"_s) {
|
|
|
value |= cmIDEFlagTable::SpaceAppendable;
|
|
|
- } else if (s == "CommaAppendable") {
|
|
|
+ } else if (s == "CommaAppendable"_s) {
|
|
|
value |= cmIDEFlagTable::CommaAppendable;
|
|
|
}
|
|
|
}
|
|
|
@@ -1537,22 +1541,22 @@ std::string cmGlobalVisualStudio10Generator::GetClFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if (toolset == "v142") {
|
|
|
+ if (toolset == "v142"_s) {
|
|
|
return "v142";
|
|
|
}
|
|
|
- if (toolset == "v141") {
|
|
|
+ if (toolset == "v141"_s) {
|
|
|
return "v141";
|
|
|
}
|
|
|
- if (useToolset == "v140") {
|
|
|
+ if (useToolset == "v140"_s) {
|
|
|
return "v140";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -1563,22 +1567,22 @@ std::string cmGlobalVisualStudio10Generator::GetCSharpFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if (useToolset == "v142") {
|
|
|
+ if (useToolset == "v142"_s) {
|
|
|
return "v142";
|
|
|
}
|
|
|
- if (useToolset == "v141") {
|
|
|
+ if (useToolset == "v141"_s) {
|
|
|
return "v141";
|
|
|
}
|
|
|
- if (useToolset == "v140") {
|
|
|
+ if (useToolset == "v140"_s) {
|
|
|
return "v140";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -1589,17 +1593,17 @@ std::string cmGlobalVisualStudio10Generator::GetRcFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if ((useToolset == "v140") || (useToolset == "v141") ||
|
|
|
- (useToolset == "v142")) {
|
|
|
+ if ((useToolset == "v140"_s) || (useToolset == "v141"_s) ||
|
|
|
+ (useToolset == "v142"_s)) {
|
|
|
return "v14";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -1610,17 +1614,17 @@ std::string cmGlobalVisualStudio10Generator::GetLibFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if ((useToolset == "v140") || (useToolset == "v141") ||
|
|
|
- (useToolset == "v142")) {
|
|
|
+ if ((useToolset == "v140"_s) || (useToolset == "v141"_s) ||
|
|
|
+ (useToolset == "v142"_s)) {
|
|
|
return "v14";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -1631,22 +1635,22 @@ std::string cmGlobalVisualStudio10Generator::GetLinkFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if (useToolset == "v142") {
|
|
|
+ if (useToolset == "v142"_s) {
|
|
|
return "v142";
|
|
|
}
|
|
|
- if (useToolset == "v141") {
|
|
|
+ if (useToolset == "v141"_s) {
|
|
|
return "v141";
|
|
|
}
|
|
|
- if (useToolset == "v140") {
|
|
|
+ if (useToolset == "v140"_s) {
|
|
|
return "v140";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|
|
|
@@ -1657,17 +1661,17 @@ std::string cmGlobalVisualStudio10Generator::GetMasmFlagTableName() const
|
|
|
std::string const& toolset = this->GetPlatformToolsetString();
|
|
|
std::string const useToolset = this->CanonicalToolsetName(toolset);
|
|
|
|
|
|
- if ((useToolset == "v140") || (useToolset == "v141") ||
|
|
|
- (useToolset == "v142")) {
|
|
|
+ if ((useToolset == "v140"_s) || (useToolset == "v141"_s) ||
|
|
|
+ (useToolset == "v142"_s)) {
|
|
|
return "v14";
|
|
|
}
|
|
|
- if (useToolset == "v120") {
|
|
|
+ if (useToolset == "v120"_s) {
|
|
|
return "v12";
|
|
|
}
|
|
|
- if (useToolset == "v110") {
|
|
|
+ if (useToolset == "v110"_s) {
|
|
|
return "v11";
|
|
|
}
|
|
|
- if (useToolset == "v100") {
|
|
|
+ if (useToolset == "v100"_s) {
|
|
|
return "v10";
|
|
|
}
|
|
|
return "";
|