cmStrCat: use in Windows-specific sources

This commit is contained in:
Ben Boeckel
2023-07-27 14:33:36 -04:00
parent 2409f62d18
commit 7137b17835
20 changed files with 582 additions and 535 deletions
+184 -156
View File
@@ -291,8 +291,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();
@@ -377,10 +377,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);
}
@@ -624,8 +624,10 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
.empty()) {
e1.Element(
"CudaToolkitCustomDir",
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString() +
this->GlobalGenerator->GetPlatformToolsetCudaNvccSubdirString());
cmStrCat(
this->GlobalGenerator->GetPlatformToolsetCudaCustomDirString(),
this->GlobalGenerator
->GetPlatformToolsetCudaNvccSubdirString()));
}
}
@@ -729,15 +731,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 +785,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 +835,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 +870,7 @@ 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);
}
@@ -893,17 +895,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 +990,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 +1017,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");
@@ -1107,7 +1113,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 +1183,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 +1199,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 +1252,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 +1279,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")) {
@@ -1400,7 +1410,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);
}
@@ -1576,7 +1586,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 +1614,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 +1629,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")) {
@@ -1724,9 +1735,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 +1822,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 +1894,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);
}
@@ -2014,11 +2025,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 +2038,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 +2052,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, "}"));
}
}
}
@@ -2376,7 +2387,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 +2419,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"_s) {
e2.WritePlatformConfigTag("DeploymentContent",
"'$(Configuration)|$(Platform)'=='" +
config + "|" + this->Platform + "'",
"true");
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");
}
}
}
@@ -2601,8 +2615,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());
@@ -2682,9 +2697,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);
}
}
@@ -2752,9 +2767,9 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// produced here.
if (!objectName.empty()) {
if (lang == "CUDA"_s) {
e2.Element("CompileOut", "$(IntDir)/" + objectName);
e2.Element("CompileOut", cmStrCat("$(IntDir)/", objectName));
} else {
e2.Element("ObjectFileName", "$(IntDir)/" + objectName);
e2.Element("ObjectFileName", cmStrCat("$(IntDir)/", objectName));
}
}
@@ -2981,9 +2996,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");
}
}
@@ -3017,7 +3032,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);
@@ -3202,7 +3217,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()
@@ -3240,8 +3255,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;
}
@@ -3333,11 +3348,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);
}
}
@@ -3345,9 +3360,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);
}
}
@@ -3594,9 +3609,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);
@@ -3737,7 +3753,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);
}
}
@@ -3762,7 +3778,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));
}
}
@@ -4143,7 +4160,8 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions(
} 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));
}
}
}
@@ -4231,7 +4249,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);
}
@@ -4239,7 +4257,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (cmValue antAdditionalOptions =
this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) {
e2.Element("AdditionalOptions",
*antAdditionalOptions + " %(AdditionalOptions)");
cmStrCat(*antAdditionalOptions, " %(AdditionalOptions)"));
}
}
@@ -4270,8 +4288,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;
}
@@ -4288,7 +4306,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string linkFlagVarBase = cmStrCat("CMAKE_", linkType, "_LINKER_FLAGS");
flags += " ";
flags += this->Makefile->GetRequiredDefinition(linkFlagVarBase);
std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
std::string linkFlagVar = cmStrCat(linkFlagVarBase, "_", CONFIG);
flags += " ";
flags += this->Makefile->GetRequiredDefinition(linkFlagVar);
cmValue targetLinkFlags = this->GeneratorTarget->GetProperty("LINK_FLAGS");
@@ -4311,8 +4329,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;
@@ -4337,7 +4355,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.push_back(cmStrCat(d, "/$(Configuration)"));
}
linkDirs.push_back("%(AdditionalLibraryDirectories)");
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
@@ -4476,8 +4494,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;
}
@@ -4793,7 +4811,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")) {
@@ -4832,17 +4851,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)
@@ -4893,7 +4913,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(
@@ -4920,9 +4940,9 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile(
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);
@@ -4930,10 +4950,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;
@@ -4974,7 +4996,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: {
@@ -4984,8 +5007,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;
@@ -5053,7 +5076,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) {
@@ -5158,13 +5181,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);
@@ -5221,22 +5244,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);
@@ -5246,7 +5269,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);
@@ -5308,7 +5331,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);
@@ -5362,7 +5385,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);
@@ -5421,7 +5444,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);
@@ -5482,7 +5505,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);
@@ -5493,36 +5516,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);
@@ -5530,7 +5555,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);
}
@@ -5605,8 +5630,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);
}
@@ -5654,8 +5680,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.
@@ -5668,7 +5695,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);
}
}