summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx525
1 files changed, 278 insertions, 247 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 90de51a..f930223 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -15,6 +15,7 @@
#include <cm/string_view>
#include <cm/vector>
#include <cmext/algorithm>
+#include <cmext/string_view>
#include "windows.h"
@@ -104,7 +105,7 @@ struct cmVisualStudio10TargetGenerator::Elem
void SetHasElements()
{
if (!HasElements) {
- this->S << ">";
+ this->S << '>';
HasElements = true;
}
}
@@ -116,13 +117,13 @@ struct cmVisualStudio10TargetGenerator::Elem
}
Elem& Attribute(const char* an, std::string av)
{
- this->S << " " << an << "=\"" << cmVS10EscapeAttr(std::move(av)) << "\"";
+ this->S << ' ' << an << "=\"" << cmVS10EscapeAttr(std::move(av)) << '"';
return *this;
}
void Content(std::string val)
{
if (!this->HasContent) {
- this->S << ">";
+ this->S << '>';
this->HasContent = true;
}
this->S << cmVS10EscapeXML(std::move(val));
@@ -135,9 +136,9 @@ struct cmVisualStudio10TargetGenerator::Elem
}
if (HasElements) {
- this->WriteString("</") << this->Tag << ">";
+ this->WriteString("</") << this->Tag << '>';
} else if (HasContent) {
- this->S << "</" << this->Tag << ">";
+ this->S << "</" << this->Tag << '>';
} else {
this->S << " />";
}
@@ -291,8 +292,8 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->TargetCompileAsWinRT = false;
this->IsMissingFiles = false;
this->DefaultArtifactDir =
- this->LocalGenerator->GetCurrentBinaryDirectory() + "/" +
- this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
+ cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
+ this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget));
this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
this->Makefile->GetCurrentBinaryDirectory());
this->ClassifyAllConfigSources();
@@ -304,16 +305,16 @@ std::string cmVisualStudio10TargetGenerator::CalcCondition(
const std::string& config) const
{
std::ostringstream oss;
- oss << "'$(Configuration)|$(Platform)'=='";
- oss << config << "|" << this->Platform;
- oss << "'";
+ oss << "'$(Configuration)|$(Platform)'=='" << config << '|' << this->Platform
+ << '\'';
// handle special case for 32 bit C# targets
if (this->ProjectType == VsProjectType::csproj &&
- this->Platform == "Win32") {
- oss << " Or ";
- oss << "'$(Configuration)|$(Platform)'=='";
- oss << config << "|x86";
- oss << "'";
+ this->Platform == "Win32"_s) {
+ oss << " Or "
+ "'$(Configuration)|$(Platform)'=='"
+ << config
+ << "|x86"
+ "'";
}
return oss.str();
}
@@ -377,10 +378,10 @@ void cmVisualStudio10TargetGenerator::Generate()
if (this->ProjectType == VsProjectType::csproj &&
this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
- std::string message = "The C# target \"" +
- this->GeneratorTarget->GetName() +
- "\" is of type STATIC_LIBRARY. This is discouraged (and may be "
- "disabled in future). Make it a SHARED library instead.";
+ std::string message =
+ cmStrCat("The C# target \"", this->GeneratorTarget->GetName(),
+ "\" is of type STATIC_LIBRARY. This is discouraged (and may be "
+ "disabled in future). Make it a SHARED library instead.");
this->Makefile->IssueMessage(MessageType::DEPRECATION_WARNING, message);
}
@@ -510,7 +511,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
// Setting ResolveNugetPackages to false skips this target and the build
// succeeds.
cm::string_view targetName{ this->GeneratorTarget->GetName() };
- if (targetName == "ALL_BUILD" || targetName == "PACKAGE" ||
+ if (targetName == "ALL_BUILD"_s || targetName == "PACKAGE"_s ||
targetName == CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
Elem e1(e0, "PropertyGroup");
e1.Element("ResolveNugetPackages", "false");
@@ -624,8 +625,10 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
.empty()) {
e1.Element(
"CudaToolkitCustomDir",
- this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() +
- this->GlobalGenerator->GetPlatformToolsetCudaNvccSubdirString());
+ cmStrCat(
+ this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(),
+ this->GlobalGenerator
+ ->GetPlatformToolsetCudaNvccSubdirString()));
}
}
@@ -729,15 +732,15 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString();
std::string cudaPath = customDir.empty()
? "$(VCTargetsPath)\\BuildCustomizations\\"
- : customDir +
- this->GlobalGenerator
- ->GetPlatformToolsetCudaVSIntegrationSubdirString() +
- R"(extras\visual_studio_integration\MSBuildExtensions\)";
+ : cmStrCat(customDir,
+ this->GlobalGenerator
+ ->GetPlatformToolsetCudaVSIntegrationSubdirString(),
+ R"(extras\visual_studio_integration\MSBuildExtensions\)");
Elem(e1, "Import")
.Attribute("Project",
- std::move(cudaPath) + "CUDA " +
- this->GlobalGenerator->GetPlatformToolsetCuda() +
- ".props");
+ cmStrCat(std::move(cudaPath), "CUDA ",
+ this->GlobalGenerator->GetPlatformToolsetCuda(),
+ ".props"));
}
if (this->GlobalGenerator->IsMarmasmEnabled()) {
Elem(e1, "Import")
@@ -783,7 +786,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
ConvertToWindowsSlash(props);
Elem(e1, "Import")
.Attribute("Project", props)
- .Attribute("Condition", "exists('" + props + "')")
+ .Attribute("Condition", cmStrCat("exists('", props, "')"))
.Attribute("Label", "LocalAppDataPlatform");
}
@@ -833,15 +836,15 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString();
std::string cudaPath = customDir.empty()
? "$(VCTargetsPath)\\BuildCustomizations\\"
- : customDir +
- this->GlobalGenerator
- ->GetPlatformToolsetCudaVSIntegrationSubdirString() +
- R"(extras\visual_studio_integration\MSBuildExtensions\)";
+ : cmStrCat(customDir,
+ this->GlobalGenerator
+ ->GetPlatformToolsetCudaVSIntegrationSubdirString(),
+ R"(extras\visual_studio_integration\MSBuildExtensions\)");
Elem(e1, "Import")
.Attribute("Project",
- std::move(cudaPath) + "CUDA " +
- this->GlobalGenerator->GetPlatformToolsetCuda() +
- ".targets");
+ cmStrCat(std::move(cudaPath), "CUDA ",
+ this->GlobalGenerator->GetPlatformToolsetCuda(),
+ ".targets"));
}
if (this->GlobalGenerator->IsMarmasmEnabled()) {
Elem(e1, "Import")
@@ -868,7 +871,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
if (this->ProjectType == VsProjectType::csproj) {
for (std::string const& c : this->Configurations) {
Elem e1(e0, "PropertyGroup");
- e1.Attribute("Condition", "'$(Configuration)' == '" + c + "'");
+ e1.Attribute("Condition",
+ cmStrCat("'$(Configuration)' == '", c, '\''));
e1.SetHasElements();
this->WriteEvents(e1, c);
}
@@ -881,7 +885,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
oss << " " << i << ";\n";
}
oss << " "
- << "$(BuildDependsOn)\n";
+ "$(BuildDependsOn)\n";
e1.Element("BuildDependsOn", oss.str());
}
}
@@ -893,17 +897,19 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
{
if (this->ProjectType != VsProjectType::csproj ||
!this->GeneratorTarget->IsDotNetSdkTarget()) {
- std::string message = "The target \"" + this->GeneratorTarget->GetName() +
- "\" is not eligible for .Net SDK style project.";
+ std::string message =
+ cmStrCat("The target \"", this->GeneratorTarget->GetName(),
+ "\" is not eligible for .Net SDK style project.");
this->Makefile->IssueMessage(MessageType::INTERNAL_ERROR, message);
return;
}
if (this->HasCustomCommands()) {
- std::string message = "The target \"" + this->GeneratorTarget->GetName() +
+ std::string message = cmStrCat(
+ "The target \"", this->GeneratorTarget->GetName(),
"\" does not currently support add_custom_command as the Visual Studio "
"generators have not yet learned how to generate custom commands in "
- ".Net SDK-style projects.";
+ ".Net SDK-style projects.");
this->Makefile->IssueMessage(MessageType::FATAL_ERROR, message);
return;
}
@@ -986,11 +992,13 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
for (const std::string& config : this->Configurations) {
Elem e1(e0, "PropertyGroup");
- e1.Attribute("Condition", "'$(Configuration)' == '" + config + "'");
+ e1.Attribute("Condition",
+ cmStrCat("'$(Configuration)' == '", config, '\''));
e1.SetHasElements();
this->WriteEvents(e1, config);
- std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/";
+ std::string outDir =
+ cmStrCat(this->GeneratorTarget->GetDirectory(config), '/');
ConvertToWindowsSlash(outDir);
e1.Element("OutputPath", outDir);
@@ -1011,7 +1019,7 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
{
e1.Attribute("Label", "Globals");
- e1.Element("ProjectGuid", "{" + this->GUID + "}");
+ e1.Element("ProjectGuid", cmStrCat('{', this->GUID, '}'));
cmValue vsProjectTypes =
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
@@ -1049,8 +1057,8 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
}
cm::string_view globalKey = cm::string_view(keyIt).substr(prefix.length());
// Skip invalid or separately-handled properties.
- if (globalKey.empty() || globalKey == "PROJECT_TYPES" ||
- globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") {
+ if (globalKey.empty() || globalKey == "PROJECT_TYPES"_s ||
+ globalKey == "ROOTNAMESPACE"_s || globalKey == "KEYWORD"_s) {
continue;
}
cmValue value = this->GeneratorTarget->GetProperty(keyIt);
@@ -1107,7 +1115,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
if (cmHasPrefix(i.first, vsDnRef)) {
std::string path = i.second;
if (!cmsys::SystemTools::FileIsFullPath(path)) {
- path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
+ path =
+ cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', path);
}
ConvertToWindowsSlash(path);
this->DotNetHintReferences[""].emplace_back(
@@ -1176,7 +1185,8 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0)
cmList argsSplit{ *imports };
for (auto& path : argsSplit) {
if (!cmsys::SystemTools::FileIsFullPath(path)) {
- path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
+ path =
+ cmStrCat(this->Makefile->GetCurrentSourceDirectory(), '/', path);
}
ConvertToWindowsSlash(path);
Elem e1(e0, "Import");
@@ -1191,7 +1201,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags(
static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_";
static const std::string refpropInfix = "_TAG_";
- const std::string refPropFullPrefix = refpropPrefix + ref + refpropInfix;
+ const std::string refPropFullPrefix =
+ cmStrCat(refpropPrefix, ref, refpropInfix);
using CustomTags = std::map<std::string, std::string>;
CustomTags tags;
cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
@@ -1243,7 +1254,8 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
e2.Attribute("Include", obj);
if (this->ProjectType != VsProjectType::csproj) {
- std::string hFileName = obj.substr(0, obj.find_last_of('.')) + ".h";
+ std::string hFileName =
+ cmStrCat(obj.substr(0, obj.find_last_of('.')), ".h");
e2.Element("DependentUpon", hFileName);
for (std::string const& c : this->Configurations) {
@@ -1269,10 +1281,10 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
e2.Element("Link", link);
}
// Determine if this is a generated resource from a .Designer.cs file
- std::string designerResource =
- cmSystemTools::GetFilenamePath(oi->GetFullPath()) + "/" +
- cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()) +
- ".Designer.cs";
+ std::string designerResource = cmStrCat(
+ cmSystemTools::GetFilenamePath(oi->GetFullPath()), '/',
+ cmSystemTools::GetFilenameWithoutLastExtension(oi->GetFullPath()),
+ ".Designer.cs");
if (cmsys::SystemTools::FileExists(designerResource)) {
std::string generator = "PublicResXFileCodeGenerator";
if (cmValue g = oi->GetProperty("VS_RESOURCE_GENERATOR")) {
@@ -1337,7 +1349,7 @@ void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences(Elem& e0)
{
if (this->MSTools) {
if (this->GlobalGenerator->TargetsWindowsPhone() &&
- this->GlobalGenerator->GetSystemVersion() == "8.0") {
+ this->GlobalGenerator->GetSystemVersion() == "8.0"_s) {
Elem(e0, "Import")
.Attribute("Project",
"$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v"
@@ -1358,9 +1370,9 @@ void cmVisualStudio10TargetGenerator::WriteTargetsFileReferences(Elem& e1)
if (j > 0) {
oss << " Or ";
}
- oss << "'$(Configuration)'=='" << tac.Configs[j] << "'";
+ oss << "'$(Configuration)'=='" << tac.Configs[j] << '\'';
}
- oss << ")";
+ oss << ')';
}
Elem(e1, "Import")
@@ -1378,7 +1390,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences(Elem& e0)
}
if (this->GlobalGenerator->TargetsWindowsPhone() &&
- this->GlobalGenerator->GetSystemVersion() == "8.0" &&
+ this->GlobalGenerator->GetSystemVersion() == "8.0"_s &&
references.empty()) {
references.push_back(std::string{ "platform.winmd" });
}
@@ -1400,7 +1412,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations(Elem& e0)
e1.Attribute("Label", "ProjectConfigurations");
for (std::string const& c : this->Configurations) {
Elem e2(e1, "ProjectConfiguration");
- e2.Attribute("Include", c + "|" + this->Platform);
+ e2.Attribute("Include", cmStrCat(c, '|', this->Platform));
e2.Element("Configuration", c);
e2.Element("Platform", this->Platform);
}
@@ -1508,9 +1520,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
std::string useOfMfcValue = "false";
if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
- if (mfcFlagValue == "1") {
+ if (mfcFlagValue == "1"_s) {
useOfMfcValue = "Static";
- } else if (mfcFlagValue == "2") {
+ } else if (mfcFlagValue == "2"_s) {
useOfMfcValue = "Dynamic";
}
}
@@ -1576,7 +1588,8 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
e1.Element("DefineDebug", "true");
}
- std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/";
+ std::string outDir =
+ cmStrCat(this->GeneratorTarget->GetDirectory(config), '/');
ConvertToWindowsSlash(outDir);
e1.Element("OutputPath", outDir);
@@ -1603,7 +1616,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
if (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType()) {
e1.Element("StartAction", "Program");
- e1.Element("StartProgram", outDir + assemblyName + ".exe");
+ e1.Element("StartProgram", cmStrCat(outDir, assemblyName, ".exe"));
}
OptionsHelper oh(o, e1);
@@ -1618,10 +1631,10 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
const char* toolset = gg->GetPlatformToolset();
e1.Element("NdkToolchainVersion", toolset ? toolset : "Default");
if (cmValue minApi = this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) {
- e1.Element("AndroidMinAPI", "android-" + *minApi);
+ e1.Element("AndroidMinAPI", cmStrCat("android-", *minApi));
}
if (cmValue api = this->GeneratorTarget->GetProperty("ANDROID_API")) {
- e1.Element("AndroidTargetAPI", "android-" + *api);
+ e1.Element("AndroidTargetAPI", cmStrCat("android-", *api));
}
if (cmValue cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH")) {
@@ -1646,7 +1659,7 @@ void cmVisualStudio10TargetGenerator::WriteAndroidConfigurationValues(
}
if (cmValue stlType =
this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) {
- if (*stlType != "none") {
+ if (*stlType != "none"_s) {
e1.Element("UseOfStl", *stlType);
}
}
@@ -1724,9 +1737,9 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
// preventing dependent rebuilds.
this->ForceOld(sourcePath);
} else {
- std::string error =
- cmStrCat("Could not create file: [", sourcePath, "] ");
- cmSystemTools::Error(error + cmSystemTools::GetLastSystemError());
+ cmSystemTools::Error(cmStrCat("Could not create file: [", sourcePath,
+ "] ",
+ cmSystemTools::GetLastSystemError()));
}
}
}
@@ -1811,8 +1824,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
}
script += lg->FinishConstructScript(this->ProjectType);
if (this->ProjectType == VsProjectType::csproj) {
- std::string name = "CustomCommand_" + c + "_" +
- cmSystemTools::ComputeStringMD5(sourcePath);
+ std::string name = cmStrCat("CustomCommand_", c, '_',
+ cmSystemTools::ComputeStringMD5(sourcePath));
this->WriteCustomRuleCSharp(e0, c, name, script, additional_inputs.str(),
outputs.str(), comment, ccg);
} else {
@@ -1883,7 +1896,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp(
e1.S << "\n Inputs=\"" << cmVS10EscapeAttr(inputs) << "\"";
e1.S << "\n Outputs=\"" << cmVS10EscapeAttr(outputs) << "\"";
if (!comment.empty()) {
- Elem(e1, "Exec").Attribute("Command", "echo " + comment);
+ Elem(e1, "Exec").Attribute("Command", cmStrCat("echo ", comment));
}
Elem(e1, "Exec").Attribute("Command", script);
}
@@ -1957,7 +1970,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
for (auto const& ti : this->Tools) {
if ((this->GeneratorTarget->GetName() ==
CMAKE_CHECK_BUILD_SYSTEM_TARGET) &&
- (ti.first == "None")) {
+ (ti.first == "None"_s)) {
this->WriteBuildSystemSources(e0, ti.first, ti.second);
} else {
this->WriteGroupSources(e0, ti.first, ti.second, sourceGroups);
@@ -1971,7 +1984,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
for (std::string const& oi : this->AddedFiles) {
std::string fileName =
cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi));
- if (fileName == "wmappmanifest.xml") {
+ if (fileName == "wmappmanifest.xml"_s) {
Elem e2(e1, "XML");
e2.Attribute("Include", oi);
e2.Element("Filter", "Resource Files");
@@ -1980,7 +1993,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
Elem e2(e1, "AppxManifest");
e2.Attribute("Include", oi);
e2.Element("Filter", "Resource Files");
- } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") {
+ } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx"_s) {
Elem e2(e1, "None");
e2.Attribute("Include", oi);
e2.Element("Filter", "Resource Files");
@@ -2014,11 +2027,11 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
for (cmSourceGroup const* sg : groupsVec) {
std::string const& name = sg->GetFullName();
if (!name.empty()) {
- std::string guidName = "SG_Filter_" + name;
+ std::string guidName = cmStrCat("SG_Filter_", name);
std::string guid = this->GlobalGenerator->GetGUID(guidName);
Elem e2(e1, "Filter");
e2.Attribute("Include", name);
- e2.Element("UniqueIdentifier", "{" + guid + "}");
+ e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}'));
}
}
@@ -2027,7 +2040,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::string guid = this->GlobalGenerator->GetGUID(guidName);
Elem e2(e1, "Filter");
e2.Attribute("Include", "Resource Files");
- e2.Element("UniqueIdentifier", "{" + guid + "}");
+ e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}'));
e2.Element("Extensions",
"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;"
"gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
@@ -2041,7 +2054,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::string guid = this->GlobalGenerator->GetGUID(guidName);
Elem e2(e1, "Filter");
e2.Attribute("Include", filter);
- e2.Element("UniqueIdentifier", "{" + guid + "}");
+ e2.Element("UniqueIdentifier", cmStrCat('{', guid, '}'));
}
}
}
@@ -2228,7 +2241,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
toolHasSettings = true;
}
- if (ext == "hlsl") {
+ if (ext == "hlsl"_s) {
tool = "FXCompile";
// Figure out the type of shader compiler to use.
if (cmValue st = sf->GetProperty("VS_SHADER_TYPE")) {
@@ -2306,22 +2319,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
toolSettings[config]["ObjectFileOutput"] = *sofn;
}
}
- } else if (ext == "jpg" || ext == "png") {
+ } else if (ext == "jpg"_s || ext == "png"_s) {
tool = "Image";
- } else if (ext == "resw") {
+ } else if (ext == "resw"_s) {
tool = "PRIResource";
- } else if (ext == "xml") {
+ } else if (ext == "xml"_s) {
tool = "XML";
- } else if (ext == "natvis") {
+ } else if (ext == "natvis"_s) {
tool = "Natvis";
- } else if (ext == "settings") {
+ } else if (ext == "settings"_s) {
settingsLastGenOutput =
cmsys::SystemTools::GetFilenameName(sf->GetFullPath());
std::size_t pos = settingsLastGenOutput.find(".settings");
settingsLastGenOutput.replace(pos, 9, ".Designer.cs");
settingsGenerator = "SettingsSingleFileGenerator";
toolHasSettings = true;
- } else if (ext == "vsixmanifest") {
+ } else if (ext == "vsixmanifest"_s) {
subType = "Designer";
}
if (cmValue c = sf->GetProperty("VS_COPY_TO_OUT_DIR")) {
@@ -2342,13 +2355,13 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
if (this->NsightTegra) {
// Nsight Tegra needs specific file types to check up-to-dateness.
std::string name = cmSystemTools::LowerCase(sf->GetLocation().GetName());
- if (name == "androidmanifest.xml" || name == "build.xml" ||
- name == "proguard.cfg" || name == "proguard-project.txt" ||
- ext == "properties") {
+ if (name == "androidmanifest.xml"_s || name == "build.xml"_s ||
+ name == "proguard.cfg"_s || name == "proguard-project.txt"_s ||
+ ext == "properties"_s) {
tool = "AndroidBuild";
- } else if (ext == "java") {
+ } else if (ext == "java"_s) {
tool = "JCompile";
- } else if (ext == "asm" || ext == "s") {
+ } else if (ext == "asm"_s || ext == "s"_s) {
tool = "ClCompile";
}
}
@@ -2376,7 +2389,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
if (ParsedToolTargetSettings.find(tool) == ParsedToolTargetSettings.end()) {
cmValue toolTargetProperty = this->GeneratorTarget->Target->GetProperty(
- "VS_SOURCE_SETTINGS_" + std::string(tool));
+ cmStrCat("VS_SOURCE_SETTINGS_", tool));
ConfigToSettings toolTargetSettings;
if (toolTargetProperty) {
ParseSettingsProperty(*toolTargetProperty, toolTargetSettings);
@@ -2408,19 +2421,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis
if (!deployLocation.empty()) {
- e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)");
+ e2.Element("Link",
+ cmStrCat(deployLocation, "\\%(FileName)%(Extension)"));
}
for (auto& config : this->Configurations) {
- if (cge->Evaluate(this->LocalGenerator, config) == "1") {
- e2.WritePlatformConfigTag("DeploymentContent",
- "'$(Configuration)|$(Platform)'=='" +
- config + "|" + this->Platform + "'",
- "true");
+ if (cge->Evaluate(this->LocalGenerator, config) == "1"_s) {
+ e2.WritePlatformConfigTag(
+ "DeploymentContent",
+ cmStrCat("'$(Configuration)|$(Platform)'=='", config, '|',
+ this->Platform, '\''),
+ "true");
} else {
- e2.WritePlatformConfigTag("ExcludedFromBuild",
- "'$(Configuration)|$(Platform)'=='" +
- config + "|" + this->Platform + "'",
- "true");
+ e2.WritePlatformConfigTag(
+ "ExcludedFromBuild",
+ cmStrCat("'$(Configuration)|$(Platform)'=='", config, '|',
+ this->Platform, '\''),
+ "true");
}
}
}
@@ -2456,7 +2472,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
// conversion uses full paths when possible to allow deeper trees.
// However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA
// we must use relative paths.
- bool forceRelative = sf->GetLanguage() == "CUDA";
+ bool forceRelative = sf->GetLanguage() == "CUDA"_s;
std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative);
ConvertToWindowsSlash(sourceFile);
e2.Attribute("Include", sourceFile);
@@ -2554,22 +2570,23 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
case cmGeneratorTarget::SourceKindUnityBatched:
case cmGeneratorTarget::SourceKindObjectSource: {
const std::string& lang = si.Source->GetLanguage();
- if (lang == "C" || lang == "CXX") {
+ if (lang == "C"_s || lang == "CXX"_s) {
tool = "ClCompile";
- } else if (lang == "ASM_MARMASM" &&
+ } else if (lang == "ASM_MARMASM"_s &&
this->GlobalGenerator->IsMarmasmEnabled()) {
tool = "MARMASM";
- } else if (lang == "ASM_MASM" &&
+ } else if (lang == "ASM_MASM"_s &&
this->GlobalGenerator->IsMasmEnabled()) {
tool = "MASM";
- } else if (lang == "ASM_NASM" &&
+ } else if (lang == "ASM_NASM"_s &&
this->GlobalGenerator->IsNasmEnabled()) {
tool = "NASM";
- } else if (lang == "RC") {
+ } else if (lang == "RC"_s) {
tool = "ResourceCompile";
- } else if (lang == "CSharp") {
+ } else if (lang == "CSharp"_s) {
tool = "Compile";
- } else if (lang == "CUDA" && this->GlobalGenerator->IsCudaEnabled()) {
+ } else if (lang == "CUDA"_s &&
+ this->GlobalGenerator->IsCudaEnabled()) {
tool = "CudaCompile";
} else {
tool = "None";
@@ -2592,7 +2609,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
std::back_inserter(exclude_configs));
Elem e2(e1, tool);
- bool isCSharp = (si.Source->GetLanguage() == "CSharp");
+ bool isCSharp = (si.Source->GetLanguage() == "CSharp"_s);
if (isCSharp && !exclude_configs.empty()) {
std::stringstream conditions;
bool firstConditionSet{ false };
@@ -2600,8 +2617,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
if (firstConditionSet) {
conditions << " Or ";
}
- conditions << "('$(Configuration)|$(Platform)'=='" +
- this->Configurations[ci] + "|" + this->Platform + "')";
+ conditions << "('$(Configuration)|$(Platform)'=='"
+ << this->Configurations[ci] << '|' << this->Platform
+ << "')";
firstConditionSet = true;
}
e2.Attribute("Condition", conditions.str());
@@ -2681,9 +2699,9 @@ void cmVisualStudio10TargetGenerator::FinishWritingSource(
writtenSettings.push_back(setting.first);
} else {
e2.WritePlatformConfigTag(setting.first,
- "'$(Configuration)|$(Platform)'=='" +
- configSettings.first + "|" +
- this->Platform + "'",
+ cmStrCat("'$(Configuration)|$(Platform)'=='",
+ configSettings.first, '|',
+ this->Platform, '\''),
setting.second);
}
}
@@ -2731,33 +2749,33 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// Force language if the file extension does not match.
// Note that MSVC treats the upper-case '.C' extension as C and not C++.
std::string const ext = sf.GetExtension();
- std::string const extLang = ext == "C"
+ std::string const extLang = ext == "C"_s
? "C"
: this->GlobalGenerator->GetLanguageFromExtension(ext.c_str());
std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf);
const char* compileAs = nullptr;
if (lang != extLang) {
- if (lang == "CXX") {
+ if (lang == "CXX"_s) {
// force a C++ file type
compileAs = "CompileAsCpp";
- } else if (lang == "C") {
+ } else if (lang == "C"_s) {
// force to c
compileAs = "CompileAsC";
}
}
- bool noWinRT = this->TargetCompileAsWinRT && lang == "C";
+ bool noWinRT = this->TargetCompileAsWinRT && lang == "C"_s;
// for the first time we need a new line if there is something
// produced here.
if (!objectName.empty()) {
- if (lang == "CUDA") {
- e2.Element("CompileOut", "$(IntDir)/" + objectName);
+ if (lang == "CUDA"_s) {
+ e2.Element("CompileOut", cmStrCat("$(IntDir)/", objectName));
} else {
- e2.Element("ObjectFileName", "$(IntDir)/" + objectName);
+ e2.Element("ObjectFileName", cmStrCat("$(IntDir)/", objectName));
}
}
- if (lang == "ASM_NASM") {
+ if (lang == "ASM_NASM"_s) {
if (cmValue objectDeps = sf.GetProperty("OBJECT_DEPENDS")) {
cmList depends{ *objectDeps };
for (auto& d : depends) {
@@ -2777,7 +2795,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
std::string defPropName = cmStrCat("COMPILE_DEFINITIONS_", configUpper);
if (cmValue ccdefs = sf.GetProperty(defPropName)) {
if (!configDefines.empty()) {
- configDefines += ";";
+ configDefines += ';';
}
configDependentDefines |=
cmGeneratorExpression::Find(*ccdefs) != std::string::npos;
@@ -2842,20 +2860,20 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmIDEFlagTable const* flagtable = nullptr;
const std::string& srclang = source->GetLanguage();
- if (srclang == "C" || srclang == "CXX") {
+ if (srclang == "C"_s || srclang == "CXX"_s) {
flagtable = gg->GetClFlagTable();
- } else if (srclang == "ASM_MARMASM" &&
+ } else if (srclang == "ASM_MARMASM"_s &&
this->GlobalGenerator->IsMarmasmEnabled()) {
flagtable = gg->GetMarmasmFlagTable();
- } else if (srclang == "ASM_MASM" &&
+ } else if (srclang == "ASM_MASM"_s &&
this->GlobalGenerator->IsMasmEnabled()) {
flagtable = gg->GetMasmFlagTable();
- } else if (lang == "ASM_NASM" &&
+ } else if (lang == "ASM_NASM"_s &&
this->GlobalGenerator->IsNasmEnabled()) {
flagtable = gg->GetNasmFlagTable();
- } else if (srclang == "RC") {
+ } else if (srclang == "RC"_s) {
flagtable = gg->GetRcFlagTable();
- } else if (srclang == "CSharp") {
+ } else if (srclang == "CSharp"_s) {
flagtable = gg->GetCSharpFlagTable();
}
cmGeneratorExpressionInterpreter genexInterpreter(
@@ -2980,9 +2998,9 @@ void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild(
{
for (size_t ci : exclude_configs) {
e2.WritePlatformConfigTag("ExcludedFromBuild",
- "'$(Configuration)|$(Platform)'=='" +
- this->Configurations[ci] + "|" +
- this->Platform + "'",
+ cmStrCat("'$(Configuration)|$(Platform)'=='",
+ this->Configurations[ci], '|',
+ this->Platform, '\''),
"true");
}
}
@@ -3016,7 +3034,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
outDir = intermediateDir;
targetNameFull = cmStrCat(this->GeneratorTarget->GetName(), ".lib");
} else {
- outDir = this->GeneratorTarget->GetDirectory(config) + "/";
+ outDir = cmStrCat(this->GeneratorTarget->GetDirectory(config), '/');
targetNameFull = this->GeneratorTarget->GetFullName(config);
}
ConvertToWindowsSlash(intermediateDir);
@@ -3201,7 +3219,7 @@ std::string cmVisualStudio10TargetGenerator::GetTargetOutputName() const
}
const auto& nameComponents =
this->GeneratorTarget->GetFullNameComponents(config);
- return nameComponents.prefix + nameComponents.base;
+ return cmStrCat(nameComponents.prefix, nameComponents.base);
}
bool cmVisualStudio10TargetGenerator::ComputeClOptions()
@@ -3239,8 +3257,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
const std::string& linkLanguage =
this->GeneratorTarget->GetLinkerLanguage(configName);
if (linkLanguage.empty()) {
- cmSystemTools::Error(
- "CMake can not determine linker language for target: " + this->Name);
+ cmSystemTools::Error(cmStrCat(
+ "CMake can not determine linker language for target: ", this->Name));
return false;
}
@@ -3332,11 +3350,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
defineFlags.find("/clr") != std::string::npos ||
defineFlags.find("-clr") != std::string::npos) {
if (configName == this->Configurations[0]) {
- std::string message = "For the target \"" +
- this->GeneratorTarget->GetName() +
- "\" the /clr compiler flag was added manually. " +
- "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME "
- "target property.";
+ std::string message =
+ cmStrCat("For the target \"", this->GeneratorTarget->GetName(),
+ "\" the /clr compiler flag was added manually. ",
+ "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME "
+ "target property.");
this->Makefile->IssueMessage(MessageType::WARNING, message);
}
}
@@ -3344,9 +3362,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) {
std::string clrString = *clr;
if (!clrString.empty()) {
- clrString = ":" + clrString;
+ clrString = cmStrCat(':', clrString);
}
- flags += " /clr" + clrString;
+ flags += cmStrCat(" /clr", clrString);
}
}
@@ -3419,7 +3437,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
// Add C-specific flags expressible in a ClCompile meant for C++.
- if (langForClCompile == "CXX") {
+ if (langForClCompile == "CXX"_s) {
std::set<std::string> languages;
this->GeneratorTarget->GetLanguages(languages, configName);
if (languages.count("C")) {
@@ -3474,7 +3492,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string managedType = clOptions.HasFlag("CompileAsManaged")
? clOptions.GetFlag("CompileAsManaged")
: "Mixed";
- if (managedType == "Safe" || managedType == "Pure") {
+ if (managedType == "Safe"_s || managedType == "Pure"_s) {
// force empty calling convention if safe clr is used
clOptions.AddFlag("CallingConvention", "");
}
@@ -3498,7 +3516,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// Remove any target-wide -TC or -TP flag added by the project.
// Such flags are unnecessary and break our model of language selection.
- if (langForClCompile == "C" || langForClCompile == "CXX") {
+ if (langForClCompile == "C"_s || langForClCompile == "CXX"_s) {
clOptions.RemoveFlag("CompileAs");
}
@@ -3593,9 +3611,10 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
Options& rcOptions = *pOptions;
std::string CONFIG = cmSystemTools::UpperCase(configName);
- std::string rcConfigFlagsVar = "CMAKE_RC_FLAGS_" + CONFIG;
- std::string flags = this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS") +
- " " + this->Makefile->GetSafeDefinition(rcConfigFlagsVar);
+ std::string rcConfigFlagsVar = cmStrCat("CMAKE_RC_FLAGS_", CONFIG);
+ std::string flags =
+ cmStrCat(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS"), ' ',
+ this->Makefile->GetSafeDefinition(rcConfigFlagsVar));
rcOptions.Parse(flags);
@@ -3736,7 +3755,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// limitation by creating the directory and passing the flag ourselves.
pdb = this->ConvertPath(pdb, true);
ConvertToWindowsSlash(pdb);
- std::string const clFd = R"(-Xcompiler="-Fd\")" + pdb + R"(\"")";
+ std::string const clFd = cmStrCat(R"(-Xcompiler="-Fd\")", pdb, R"(\"")");
cudaOptions.AppendFlagString("AdditionalOptions", clFd);
}
}
@@ -3744,7 +3763,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// CUDA automatically passes the proper '--machine' flag to nvcc
// for the current architecture, but does not reflect this default
// in the user-visible IDE settings. Set it explicitly.
- if (this->Platform == "x64") {
+ if (this->Platform == "x64"_s) {
cudaOptions.AddFlag("TargetMachinePlatform", "64");
}
@@ -3761,7 +3780,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
cudaOptions.RemoveFlag("AdditionalCompilerOptions");
if (!aco.empty()) {
aco = this->LocalGenerator->EscapeForShell(aco, false);
- cudaOptions.AppendFlagString("AdditionalOptions", "-Xcompiler=" + aco);
+ cudaOptions.AppendFlagString("AdditionalOptions",
+ cmStrCat("-Xcompiler=", aco));
}
}
@@ -3787,11 +3807,11 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// Add runtime library selection flag.
std::string const& cudaRuntime =
this->GeneratorTarget->GetRuntimeLinkLibrary("CUDA", configName);
- if (cudaRuntime == "STATIC") {
+ if (cudaRuntime == "STATIC"_s) {
cudaOptions.AddFlag("CudaRuntime", "Static");
- } else if (cudaRuntime == "SHARED") {
+ } else if (cudaRuntime == "SHARED"_s) {
cudaOptions.AddFlag("CudaRuntime", "Shared");
- } else if (cudaRuntime == "NONE") {
+ } else if (cudaRuntime == "NONE"_s) {
cudaOptions.AddFlag("CudaRuntime", "None");
}
@@ -4135,14 +4155,15 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions(
e2.Element("AdditionalManifestFiles", oss.str());
}
if (dpiAware) {
- if (*dpiAware == "PerMonitor") {
+ if (*dpiAware == "PerMonitor"_s) {
e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware");
} else if (cmIsOn(*dpiAware)) {
e2.Element("EnableDpiAwareness", "true");
} else if (cmIsOff(*dpiAware)) {
e2.Element("EnableDpiAwareness", "false");
} else {
- cmSystemTools::Error("Bad parameter for VS_DPI_AWARE: " + *dpiAware);
+ cmSystemTools::Error(
+ cmStrCat("Bad parameter for VS_DPI_AWARE: ", *dpiAware));
}
}
}
@@ -4230,7 +4251,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
}
{
- std::string manifest_xml = rootDir + "/AndroidManifest.xml";
+ std::string manifest_xml = cmStrCat(rootDir, "/AndroidManifest.xml");
ConvertToWindowsSlash(manifest_xml);
e2.Element("AndroidManifestLocation", manifest_xml);
}
@@ -4238,7 +4259,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (cmValue antAdditionalOptions =
this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) {
e2.Element("AdditionalOptions",
- *antAdditionalOptions + " %(AdditionalOptions)");
+ cmStrCat(*antAdditionalOptions, " %(AdditionalOptions)"));
}
}
@@ -4269,8 +4290,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
const std::string& linkLanguage = linkClosure->LinkerLanguage;
if (linkLanguage.empty()) {
- cmSystemTools::Error(
- "CMake can not determine linker language for target: " + this->Name);
+ cmSystemTools::Error(cmStrCat(
+ "CMake can not determine linker language for target: ", this->Name));
return false;
}
@@ -4285,19 +4306,19 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
}
std::string flags;
std::string linkFlagVarBase = cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS");
- flags += " ";
+ flags += ' ';
flags += this->Makefile->GetRequiredDefinition(linkFlagVarBase);
- std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
- flags += " ";
+ std::string linkFlagVar = cmStrCat(linkFlagVarBase, '_', CONFIG);
+ flags += ' ';
flags += this->Makefile->GetRequiredDefinition(linkFlagVar);
cmValue targetLinkFlags = this->GeneratorTarget->GetProperty("LINK_FLAGS");
if (targetLinkFlags) {
- flags += " ";
+ flags += ' ';
flags += *targetLinkFlags;
}
std::string flagsProp = cmStrCat("LINK_FLAGS_", CONFIG);
if (cmValue flagsConfig = this->GeneratorTarget->GetProperty(flagsProp)) {
- flags += " ";
+ flags += ' ';
flags += *flagsConfig;
}
@@ -4310,8 +4331,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
cmSystemTools::Error(
- "CMake can not compute cmComputeLinkInformation for target: " +
- this->Name);
+ cmStrCat("CMake can not compute cmComputeLinkInformation for target: ",
+ this->Name));
return false;
}
cmComputeLinkInformation& cli = *pcli;
@@ -4336,7 +4357,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
// first just full path
linkDirs.push_back(d);
// next path with configuration type Debug, Release, etc
- linkDirs.push_back(d + "/$(Configuration)");
+ linkDirs.emplace_back(cmStrCat(d, "/$(Configuration)"));
}
linkDirs.push_back("%(AdditionalLibraryDirectories)");
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
@@ -4378,7 +4399,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
}
if (cmValue stackVal = this->Makefile->GetDefinition(
- "CMAKE_" + linkLanguage + "_STACK_SIZE")) {
+ cmStrCat("CMAKE_", linkLanguage, "_STACK_SIZE"))) {
linkOptions.AddFlag("StackReserveSize", *stackVal);
}
@@ -4410,7 +4431,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
}
if (this->GlobalGenerator->TargetsWindowsPhone() &&
- this->GlobalGenerator->GetSystemVersion() == "8.0") {
+ this->GlobalGenerator->GetSystemVersion() == "8.0"_s) {
// WindowsPhone 8.0 does not have ole32.
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib");
}
@@ -4475,8 +4496,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLibOptions(
this->GeneratorTarget->GetLinkInformation(config);
if (!pcli) {
cmSystemTools::Error(
- "CMake can not compute cmComputeLinkInformation for target: " +
- this->Name);
+ cmStrCat("CMake can not compute cmComputeLinkInformation for target: ",
+ this->Name));
return false;
}
@@ -4792,7 +4813,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
ConvertToWindowsSlash(path);
Elem e2(e1, "ProjectReference");
e2.Attribute("Include", path);
- e2.Element("Project", "{" + this->GlobalGenerator->GetGUID(name) + "}");
+ e2.Element("Project",
+ cmStrCat('{', this->GlobalGenerator->GetGUID(name), '}'));
e2.Element("Name", name);
this->WriteDotNetReferenceCustomTags(e2, name);
if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) {
@@ -4831,17 +4853,18 @@ void cmVisualStudio10TargetGenerator::WritePlatformExtensions(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension(
Elem& e1, std::string const& extension, std::string const& version)
{
- const std::string s = "$([Microsoft.Build.Utilities.ToolLocationHelper]"
- "::GetPlatformExtensionSDKLocation(`" +
- extension + ", Version=" + version +
- "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, "
- "$(ExtensionSDKDirectoryRoot), null))"
- "\\DesignTime\\CommonConfiguration\\Neutral\\" +
- extension + ".props";
+ const std::string s =
+ cmStrCat("$([Microsoft.Build.Utilities.ToolLocationHelper]"
+ "::GetPlatformExtensionSDKLocation(`",
+ extension, ", Version=", version,
+ "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, "
+ "$(ExtensionSDKDirectoryRoot), null))"
+ "\\DesignTime\\CommonConfiguration\\Neutral\\",
+ extension, ".props");
Elem e2(e1, "Import");
e2.Attribute("Project", s);
- e2.Attribute("Condition", "exists('" + s + "')");
+ e2.Attribute("Condition", cmStrCat("exists('", s, "')"));
}
void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0)
@@ -4892,7 +4915,7 @@ void cmVisualStudio10TargetGenerator::WriteSingleSDKReference(
Elem& e1, std::string const& extension, std::string const& version)
{
Elem(e1, "SDKReference")
- .Attribute("Include", extension + ", Version=" + version);
+ .Attribute("Include", cmStrCat(extension, ", Version=", version));
}
void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
@@ -4913,15 +4936,15 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
if (this->IsMissingFiles &&
!(this->GlobalGenerator->TargetsWindowsPhone() &&
- this->GlobalGenerator->GetSystemVersion() == "8.0")) {
+ this->GlobalGenerator->GetSystemVersion() == "8.0"_s)) {
// Move the manifest to a project directory to avoid clashes
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
Elem e1(e0, "PropertyGroup");
- e1.Element("AppxPackageArtifactsDir", artifactDir + "\\");
+ e1.Element("AppxPackageArtifactsDir", cmStrCat(artifactDir, '\\'));
std::string resourcePriFile =
- this->DefaultArtifactDir + "/resources.pri";
+ cmStrCat(this->DefaultArtifactDir, "/resources.pri");
ConvertToWindowsSlash(resourcePriFile);
e1.Element("ProjectPriFullPath", resourcePriFile);
@@ -4929,10 +4952,12 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
// aren't targeting WP8.0, add a default certificate
if (pfxFile.empty()) {
std::string templateFolder =
- cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
- pfxFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx";
- cmSystemTools::CopyAFile(templateFolder + "/Windows_TemporaryKey.pfx",
- pfxFile, false);
+ cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows");
+ pfxFile =
+ cmStrCat(this->DefaultArtifactDir, "/Windows_TemporaryKey.pfx");
+ cmSystemTools::CopyAFile(
+ cmStrCat(templateFolder, "/Windows_TemporaryKey.pfx"), pfxFile,
+ false);
ConvertToWindowsSlash(pfxFile);
this->AddedFiles.push_back(pfxFile);
this->AddedDefaultCertificate = true;
@@ -4973,7 +4998,8 @@ void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource(
// where the user supplied the file name and Visual Studio
// appended the suffix.
std::string resx = acs.Source->ResolveFullPath();
- std::string hFileName = resx.substr(0, resx.find_last_of('.')) + ".h";
+ std::string hFileName =
+ cmStrCat(resx.substr(0, resx.find_last_of('.')), ".h");
this->ExpectedResxHeaders.insert(hFileName);
} break;
case cmGeneratorTarget::SourceKindXaml: {
@@ -4983,8 +5009,8 @@ void cmVisualStudio10TargetGenerator::ClassifyAllConfigSource(
// where the user supplied the file name and Visual Studio
// appended the suffix.
std::string xaml = acs.Source->ResolveFullPath();
- std::string hFileName = xaml + ".h";
- std::string cppFileName = xaml + ".cpp";
+ std::string hFileName = cmStrCat(xaml, ".h");
+ std::string cppFileName = cmStrCat(xaml, ".cpp");
this->ExpectedXamlHeaders.insert(hFileName);
this->ExpectedXamlSources.insert(cppFileName);
} break;
@@ -5023,7 +5049,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
e1.Element("ApplicationType",
(isWindowsPhone ? "Windows Phone" : "Windows Store"));
e1.Element("DefaultLanguage", "en-US");
- if (rev == "10.0") {
+ if (rev == "10.0"_s) {
e1.Element("ApplicationTypeRevision", rev);
// Visual Studio 14.0 is necessary for building 10.0 apps
e1.Element("MinimumVisualStudioVersion", "14.0");
@@ -5031,7 +5057,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
isAppContainer = true;
}
- } else if (rev == "8.1") {
+ } else if (rev == "8.1"_s) {
e1.Element("ApplicationTypeRevision", rev);
// Visual Studio 12.0 is necessary for building 8.1 apps
e1.Element("MinimumVisualStudioVersion", "12.0");
@@ -5039,7 +5065,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) {
isAppContainer = true;
}
- } else if (rev == "8.0") {
+ } else if (rev == "8.0"_s) {
e1.Element("ApplicationTypeRevision", rev);
// Visual Studio 11.0 is necessary for building 8.0 apps
e1.Element("MinimumVisualStudioVersion", "11.0");
@@ -5052,7 +5078,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
cmStateEnums::EXECUTABLE) {
e1.Element("XapOutputs", "true");
e1.Element("XapFilename",
- this->Name + "_$(Configuration)_$(Platform).xap");
+ cmStrCat(this->Name, "_$(Configuration)_$(Platform).xap"));
}
}
} else if (isAndroid) {
@@ -5063,9 +5089,9 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
if (isAppContainer) {
e1.Element("AppContainerApplication", "true");
} else if (!isAndroid) {
- if (this->Platform == "ARM64") {
+ if (this->Platform == "ARM64"_s) {
e1.Element("WindowsSDKDesktopARM64Support", "true");
- } else if (this->Platform == "ARM") {
+ } else if (this->Platform == "ARM"_s) {
e1.Element("WindowsSDKDesktopARMSupport", "true");
}
}
@@ -5078,7 +5104,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1)
"VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
if (targetPlatformMinVersion) {
e1.Element("WindowsTargetPlatformMinVersion", *targetPlatformMinVersion);
- } else if (isWindowsStore && rev == "10.0") {
+ } else if (isWindowsStore && rev == "10.0"_s) {
// If the min version is not set, then use the TargetPlatformVersion
if (!targetPlatformVersion.empty()) {
e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion);
@@ -5101,7 +5127,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
cmGeneratorTarget::SourceKindAppManifest);
std::string const& v = this->GlobalGenerator->GetSystemVersion();
if (this->GlobalGenerator->TargetsWindowsPhone()) {
- if (v == "8.0") {
+ if (v == "8.0"_s) {
// Look through the sources for WMAppManifest.xml
bool foundManifest = false;
for (cmGeneratorTarget::AllConfigSource const& source :
@@ -5117,16 +5143,16 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
if (!foundManifest) {
this->IsMissingFiles = true;
}
- } else if (v == "8.1") {
+ } else if (v == "8.1"_s) {
if (manifestSources.empty()) {
this->IsMissingFiles = true;
}
}
} else if (this->GlobalGenerator->TargetsWindowsStore()) {
if (manifestSources.empty()) {
- if (v == "8.0") {
+ if (v == "8.0"_s) {
this->IsMissingFiles = true;
- } else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) {
+ } else if (v == "8.1"_s || cmHasLiteralPrefix(v, "10.0")) {
this->IsMissingFiles = true;
}
}
@@ -5138,15 +5164,15 @@ void cmVisualStudio10TargetGenerator::WriteMissingFiles(Elem& e1)
{
std::string const& v = this->GlobalGenerator->GetSystemVersion();
if (this->GlobalGenerator->TargetsWindowsPhone()) {
- if (v == "8.0") {
+ if (v == "8.0"_s) {
this->WriteMissingFilesWP80(e1);
- } else if (v == "8.1") {
+ } else if (v == "8.1"_s) {
this->WriteMissingFilesWP81(e1);
}
} else if (this->GlobalGenerator->TargetsWindowsStore()) {
- if (v == "8.0") {
+ if (v == "8.0"_s) {
this->WriteMissingFilesWS80(e1);
- } else if (v == "8.1") {
+ } else if (v == "8.1"_s) {
this->WriteMissingFilesWS81(e1);
} else if (cmHasLiteralPrefix(v, "10.0")) {
this->WriteMissingFilesWS10_0(e1);
@@ -5157,13 +5183,13 @@ void cmVisualStudio10TargetGenerator::WriteMissingFiles(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
{
std::string templateFolder =
- cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
+ cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows");
// For WP80, the manifest needs to be in the same folder as the project
// this can cause an overwrite problem if projects aren't organized in
// folders
- std::string manifestFile =
- this->LocalGenerator->GetCurrentBinaryDirectory() + "/WMAppManifest.xml";
+ std::string manifestFile = cmStrCat(
+ this->LocalGenerator->GetCurrentBinaryDirectory(), "/WMAppManifest.xml");
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -5220,22 +5246,22 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
}
this->AddedFiles.push_back(sourceFile);
- std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png";
- cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo,
- false);
+ std::string smallLogo = cmStrCat(this->DefaultArtifactDir, "/SmallLogo.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo.png"),
+ smallLogo, false);
ConvertToWindowsSlash(smallLogo);
Elem(e1, "Image").Attribute("Include", smallLogo);
this->AddedFiles.push_back(smallLogo);
- std::string logo = this->DefaultArtifactDir + "/Logo.png";
- cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
+ std::string logo = cmStrCat(this->DefaultArtifactDir, "/Logo.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/Logo.png"), logo, false);
ConvertToWindowsSlash(logo);
Elem(e1, "Image").Attribute("Include", logo);
this->AddedFiles.push_back(logo);
std::string applicationIcon =
- this->DefaultArtifactDir + "/ApplicationIcon.png";
- cmSystemTools::CopyAFile(templateFolder + "/ApplicationIcon.png",
+ cmStrCat(this->DefaultArtifactDir, "/ApplicationIcon.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/ApplicationIcon.png"),
applicationIcon, false);
ConvertToWindowsSlash(applicationIcon);
Elem(e1, "Image").Attribute("Include", applicationIcon);
@@ -5245,7 +5271,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1)
{
std::string manifestFile =
- this->DefaultArtifactDir + "/package.appxManifest";
+ cmStrCat(this->DefaultArtifactDir, "/package.appxManifest");
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -5307,7 +5333,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1)
{
std::string manifestFile =
- this->DefaultArtifactDir + "/package.appxManifest";
+ cmStrCat(this->DefaultArtifactDir, "/package.appxManifest");
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -5361,7 +5387,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1)
{
std::string manifestFile =
- this->DefaultArtifactDir + "/package.appxManifest";
+ cmStrCat(this->DefaultArtifactDir, "/package.appxManifest");
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -5420,7 +5446,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81(Elem& e1)
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0(Elem& e1)
{
std::string manifestFile =
- this->DefaultArtifactDir + "/package.appxManifest";
+ cmStrCat(this->DefaultArtifactDir, "/package.appxManifest");
std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
ConvertToWindowsSlash(artifactDir);
@@ -5481,7 +5507,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
Elem& e1, const std::string& manifestFile)
{
std::string templateFolder =
- cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
+ cmStrCat(cmSystemTools::GetCMakeRoot(), "/Templates/Windows");
std::string sourceFile = this->ConvertPath(manifestFile, false);
ConvertToWindowsSlash(sourceFile);
@@ -5492,36 +5518,38 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
}
this->AddedFiles.push_back(sourceFile);
- std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png";
- cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo,
- false);
+ std::string smallLogo = cmStrCat(this->DefaultArtifactDir, "/SmallLogo.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo.png"),
+ smallLogo, false);
ConvertToWindowsSlash(smallLogo);
Elem(e1, "Image").Attribute("Include", smallLogo);
this->AddedFiles.push_back(smallLogo);
- std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png";
- cmSystemTools::CopyAFile(templateFolder + "/SmallLogo44x44.png", smallLogo44,
- false);
+ std::string smallLogo44 =
+ cmStrCat(this->DefaultArtifactDir, "/SmallLogo44x44.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SmallLogo44x44.png"),
+ smallLogo44, false);
ConvertToWindowsSlash(smallLogo44);
Elem(e1, "Image").Attribute("Include", smallLogo44);
this->AddedFiles.push_back(smallLogo44);
- std::string logo = this->DefaultArtifactDir + "/Logo.png";
- cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
+ std::string logo = cmStrCat(this->DefaultArtifactDir, "/Logo.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/Logo.png"), logo, false);
ConvertToWindowsSlash(logo);
Elem(e1, "Image").Attribute("Include", logo);
this->AddedFiles.push_back(logo);
- std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png";
- cmSystemTools::CopyAFile(templateFolder + "/StoreLogo.png", storeLogo,
- false);
+ std::string storeLogo = cmStrCat(this->DefaultArtifactDir, "/StoreLogo.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/StoreLogo.png"),
+ storeLogo, false);
ConvertToWindowsSlash(storeLogo);
Elem(e1, "Image").Attribute("Include", storeLogo);
this->AddedFiles.push_back(storeLogo);
- std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png";
- cmSystemTools::CopyAFile(templateFolder + "/SplashScreen.png", splashScreen,
- false);
+ std::string splashScreen =
+ cmStrCat(this->DefaultArtifactDir, "/SplashScreen.png");
+ cmSystemTools::CopyAFile(cmStrCat(templateFolder, "/SplashScreen.png"),
+ splashScreen, false);
ConvertToWindowsSlash(splashScreen);
Elem(e1, "Image").Attribute("Include", splashScreen);
this->AddedFiles.push_back(splashScreen);
@@ -5529,7 +5557,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
if (this->AddedDefaultCertificate) {
// This file has already been added to the build so don't copy it
std::string keyFile =
- this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx";
+ cmStrCat(this->DefaultArtifactDir, "/Windows_TemporaryKey.pfx");
ConvertToWindowsSlash(keyFile);
Elem(e1, "None").Attribute("Include", keyFile);
}
@@ -5604,8 +5632,9 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(fullFileName, sourceGroups);
if (sourceGroup && !sourceGroup->GetFullName().empty()) {
- sourceGroupedFile = sourceGroup->GetFullName() + "/" +
- cmsys::SystemTools::GetFilenameName(fullFileName);
+ sourceGroupedFile =
+ cmStrCat(sourceGroup->GetFullName(), '/',
+ cmsys::SystemTools::GetFilenameName(fullFileName));
cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile);
}
@@ -5653,8 +5682,9 @@ void cmVisualStudio10TargetGenerator::UpdateCache()
// Store a cache entry that later determines, if a package restore is
// required.
this->GeneratorTarget->Makefile->AddCacheDefinition(
- this->GeneratorTarget->GetName() + "_REQUIRES_VS_PACKAGE_RESTORE", "ON",
- "Value Computed by CMake", cmStateEnums::STATIC);
+ cmStrCat(this->GeneratorTarget->GetName(),
+ "_REQUIRES_VS_PACKAGE_RESTORE"),
+ "ON", "Value Computed by CMake", cmStateEnums::STATIC);
} else {
// If there are any dependencies that require package restore, inherit the
// cache variable.
@@ -5667,7 +5697,8 @@ void cmVisualStudio10TargetGenerator::UpdateCache()
for (cmGeneratorTarget const* dt : depends) {
if (dt->HasPackageReferences()) {
this->GeneratorTarget->Makefile->AddCacheDefinition(
- this->GeneratorTarget->GetName() + "_REQUIRES_VS_PACKAGE_RESTORE",
+ cmStrCat(this->GeneratorTarget->GetName(),
+ "_REQUIRES_VS_PACKAGE_RESTORE"),
"ON", "Value Computed by CMake", cmStateEnums::STATIC);
}
}