summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-07-27 18:33:36 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-07-28 00:00:59 (GMT)
commit7137b1783549fb33fcc09eabdd0d77511d36c23b (patch)
tree2253f23d4869879ae5dbcee47c0ac8025b7a8aaa /Source
parent2409f62d18b714f3342db99201eadc13420708da (diff)
downloadCMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.zip
CMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.tar.gz
CMake-7137b1783549fb33fcc09eabdd0d77511d36c23b.tar.bz2
cmStrCat: use in Windows-specific sources
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx48
-rw-r--r--Source/CPack/WiX/cmWIXAccessControlList.cxx5
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx12
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx310
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx35
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx48
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx40
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx23
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx8
-rw-r--r--Source/cmGlobalVisualStudio9Generator.cxx11
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx29
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx134
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx38
-rw-r--r--Source/cmVSSetupHelper.cxx11
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx340
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx2
-rw-r--r--Source/cmVisualStudioSlnData.cxx4
-rw-r--r--Source/cmVisualStudioSlnParser.cxx6
-rw-r--r--Source/cmVisualStudioWCEPlatformParser.cxx9
20 files changed, 582 insertions, 535 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 3a116db..e9138ee 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -55,7 +55,7 @@ int cmCPackWIXGenerator::InitializeInternal()
bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
{
- std::string logFileName = this->CPackTopLevel + "/wix.log";
+ std::string logFileName = cmStrCat(this->CPackTopLevel, "/wix.log");
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Running WiX command: " << command << std::endl);
@@ -113,7 +113,7 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile,
}
if (!cmHasSuffix(sourceFile, this->CPackTopLevel)) {
- command << " " << QuotePath("-I" + this->CPackTopLevel);
+ command << " " << QuotePath(cmStrCat("-I", this->CPackTopLevel));
}
AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command);
@@ -198,7 +198,8 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
}
if (!GetOption("CPACK_WIX_LICENSE_RTF")) {
- std::string licenseFilename = this->CPackTopLevel + "/License.rtf";
+ std::string licenseFilename =
+ cmStrCat(this->CPackTopLevel, "/License.rtf");
SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename);
if (!CreateLicenseFile()) {
@@ -295,7 +296,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
usedBaseNames.insert(uniqueBaseName);
std::string objectFilename =
- this->CPackTopLevel + "/" + uniqueBaseName + ".wixobj";
+ cmStrCat(this->CPackTopLevel, "/", uniqueBaseName, ".wixobj");
if (!RunCandleCommand(CMakeToWixPath(sourceFilename),
CMakeToWixPath(objectFilename))) {
@@ -334,7 +335,8 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
{
- std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi";
+ std::string includeFilename =
+ cmStrCat(this->CPackTopLevel, "/cpack_variables.wxi");
cmWIXSourceWriter includeFile(this->Logger, includeFilename,
this->ComponentGuidType,
@@ -358,7 +360,8 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
{
- std::string includeFilename = this->CPackTopLevel + "/properties.wxi";
+ std::string includeFilename =
+ cmStrCat(this->CPackTopLevel, "/properties.wxi");
cmWIXSourceWriter includeFile(this->Logger, includeFilename,
this->ComponentGuidType,
@@ -407,7 +410,8 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile()
{
- std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi";
+ std::string includeFilename =
+ cmStrCat(this->CPackTopLevel, "/product_fragment.wxi");
cmWIXSourceWriter includeFile(this->Logger, includeFilename,
this->ComponentGuidType,
@@ -446,7 +450,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
// if install folder is supposed to be set absolutely, the default
// component guid "*" cannot be used
std::string directoryDefinitionsFilename =
- this->CPackTopLevel + "/directories.wxs";
+ cmStrCat(this->CPackTopLevel, "/directories.wxs");
this->WixSources.push_back(directoryDefinitionsFilename);
@@ -468,7 +472,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(),
installRoot);
- std::string fileDefinitionsFilename = this->CPackTopLevel + "/files.wxs";
+ std::string fileDefinitionsFilename =
+ cmStrCat(this->CPackTopLevel, "/files.wxs");
this->WixSources.push_back(fileDefinitionsFilename);
@@ -479,7 +484,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
fileDefinitions.BeginElement("Fragment");
std::string featureDefinitionsFilename =
- this->CPackTopLevel + "/features.wxs";
+ cmStrCat(this->CPackTopLevel, "/features.wxs");
this->WixSources.push_back(featureDefinitionsFilename);
@@ -538,7 +543,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string componentPath = cmStrCat(toplevel, '/', component.Name);
- std::string const componentFeatureId = "CM_C_" + component.Name;
+ std::string const componentFeatureId = cmStrCat("CM_C_", component.Name);
cmWIXShortcuts featureShortcuts;
AddComponentsToFeature(componentPath, componentFeatureId,
@@ -638,7 +643,7 @@ bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
return false;
}
- std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs";
+ std::string mainSourceFilePath = cmStrCat(this->CPackTopLevel, "/main.wxs");
if (!ConfigureFile(wixTemplate, mainSourceFilePath)) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -796,7 +801,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
std::string componentId = "CM_SHORTCUT";
if (idPrefix.size()) {
- componentId += "_" + idPrefix;
+ componentId += cmStrCat("_", idPrefix);
}
componentId += idSuffix;
@@ -812,7 +817,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
this->Patch->ApplyFragment(componentId, fileDefinitions);
std::string registryKey =
- std::string("Software\\") + cpackVendor + "\\" + cpackPackageName;
+ cmStrCat("Software\\", cpackVendor, "\\", cpackPackageName);
shortcuts.EmitShortcuts(type, registryKey, cpackComponentName,
fileDefinitions);
@@ -821,8 +826,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
cmValue cpackWixProgramMenuFolder =
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder != "."_s) {
- fileDefinitions.EmitRemoveFolder("CM_REMOVE_PROGRAM_MENU_FOLDER" +
- idSuffix);
+ fileDefinitions.EmitRemoveFolder(
+ cmStrCat("CM_REMOVE_PROGRAM_MENU_FOLDER", idSuffix));
}
}
@@ -929,7 +934,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
continue;
}
- std::string fullPath = topdir + "/" + fileName;
+ std::string fullPath = cmStrCat(topdir, "/", fileName);
std::string relativePath =
cmSystemTools::RelativePath(toplevel.c_str(), fullPath.c_str());
@@ -937,7 +942,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string id = PathToId(relativePath);
if (cmSystemTools::FileIsDirectory(fullPath.c_str())) {
- std::string subDirectoryId = std::string("CM_D") + id;
+ std::string subDirectoryId = cmStrCat("CM_D", id);
directoryDefinitions.BeginElement("Directory");
directoryDefinitions.AddAttribute("Id", subDirectoryId);
@@ -967,7 +972,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions(
std::string const& textLabel = packageExecutables[j];
if (cmSystemTools::LowerCase(fileName) ==
- cmSystemTools::LowerCase(executableName) + ".exe") {
+ cmStrCat(cmSystemTools::LowerCase(executableName), ".exe")) {
cmWIXShortcut shortcut;
shortcut.label = textLabel;
shortcut.workingDirectoryId = directoryId;
@@ -1036,7 +1041,7 @@ std::string cmCPackWIXGenerator::GenerateGUID()
std::string cmCPackWIXGenerator::QuotePath(std::string const& path)
{
- return std::string("\"") + path + '"';
+ return cmStrCat("\"", path, '"');
}
std::string cmCPackWIXGenerator::GetRightmostExtension(
@@ -1225,6 +1230,7 @@ std::string cmCPackWIXGenerator::RelativePathWithoutComponentPrefix(
void cmCPackWIXGenerator::InjectXmlNamespaces(cmWIXSourceWriter& sourceWriter)
{
for (auto& ns : this->CustomXmlNamespaces) {
- sourceWriter.AddAttributeUnlessEmpty("xmlns:" + ns.first, ns.second);
+ sourceWriter.AddAttributeUnlessEmpty(cmStrCat("xmlns:", ns.first),
+ ns.second);
}
}
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
index 2261a66..5dcd086 100644
--- a/Source/CPack/WiX/cmWIXAccessControlList.cxx
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -118,9 +118,8 @@ void cmWIXAccessControlList::EmitBooleanAttribute(std::string const& entry,
std::string const& name)
{
if (!this->IsBooleanAttribute(name)) {
- std::ostringstream message;
- message << "Unknown boolean attribute '" << name << "'";
- this->ReportError(entry, message.str());
+ this->ReportError(entry,
+ cmStrCat("Unknown boolean attribute '", name, "'"));
}
this->SourceWriter.AddAttribute(name, "yes");
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index a7a0648..3246e98 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmWIXFeaturesSourceWriter.h"
+#include "cmStringAlgorithms.h"
+
cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter(
cmCPackLog* logger, std::string const& filename, GuidType componentGuidType)
: cmWIXSourceWriter(logger, filename, componentGuidType)
@@ -17,7 +19,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry(
AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY"));
std::string registryKey =
- std::string("Software\\Kitware\\CMake\\Packages\\") + package;
+ cmStrCat("Software\\Kitware\\CMake\\Packages\\", package);
BeginElement("RegistryValue");
AddAttribute("Root", "HKLM");
@@ -35,7 +37,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
cmCPackComponentGroup const& group, cmWIXPatch& patch)
{
BeginElement("Feature");
- AddAttribute("Id", "CM_G_" + group.Name);
+ AddAttribute("Id", cmStrCat("CM_G_", group.Name));
if (group.IsExpandedByDefault) {
AddAttribute("Display", "expand");
@@ -44,7 +46,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup(
AddAttributeUnlessEmpty("Title", group.DisplayName);
AddAttributeUnlessEmpty("Description", group.Description);
- patch.ApplyFragment("CM_G_" + group.Name, *this);
+ patch.ApplyFragment(cmStrCat("CM_G_", group.Name), *this);
for (cmCPackComponentGroup* subgroup : group.Subgroups) {
EmitFeatureForComponentGroup(*subgroup, patch);
@@ -61,7 +63,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent(
cmCPackComponent const& component, cmWIXPatch& patch)
{
BeginElement("Feature");
- AddAttribute("Id", "CM_C_" + component.Name);
+ AddAttribute("Id", cmStrCat("CM_C_", component.Name));
AddAttributeUnlessEmpty("Title", component.DisplayName);
AddAttributeUnlessEmpty("Description", component.Description);
@@ -78,7 +80,7 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent(
AddAttribute("Level", "2");
}
- patch.ApplyFragment("CM_C_" + component.Name, *this);
+ patch.ApplyFragment(cmStrCat("CM_C_", component.Name), *this);
EndElement("Feature");
}
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 8befa75..9a8e64d 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -84,10 +84,10 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
{
if (this->SystemIsWindowsCE && ts.empty() &&
this->DefaultPlatformToolset.empty()) {
- std::ostringstream e;
- e << this->GetName() << " Windows CE version '" << this->SystemVersion
- << "' requires CMAKE_GENERATOR_TOOLSET to be set.";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(this->GetName(), " Windows CE version '", this->SystemVersion,
+ "' requires CMAKE_GENERATOR_TOOLSET to be set."));
return false;
}
@@ -106,16 +106,17 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
if (!this->CustomFlagTableDir.empty() &&
!(cmSystemTools::FileIsFullPath(this->CustomFlagTableDir) &&
cmSystemTools::FileIsDirectory(this->CustomFlagTableDir))) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset\n"
- " customFlagTableDir=" << this->CustomFlagTableDir << "\n"
- "that is not an absolute path to an existing directory.";
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset\n"
+ " customFlagTableDir=",
+ this->CustomFlagTableDir,
+ "\n"
+ "that is not an absolute path to an existing directory."));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -126,7 +127,8 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
// differing from the "false" and "true" values used in older toolsets.
// A VS 2015 update changed it back. Parse the "link.xml" file to
// discover which one we need.
- std::string const link_xml = this->VCTargetsPath + "/1033/link.xml";
+ std::string const link_xml =
+ cmStrCat(this->VCTargetsPath, "/1033/link.xml");
cmsys::ifstream fin(link_xml.c_str());
std::string line;
while (fin && cmSystemTools::GetLineFromStream(fin, line)) {
@@ -141,24 +143,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
this->SupportsUnityBuilds =
this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 ||
(this->Version == cmGlobalVisualStudioGenerator::VSVersion::VS15 &&
- cmSystemTools::PathExists(this->VCTargetsPath +
- "/Microsoft.Cpp.Unity.targets"));
+ cmSystemTools::PathExists(
+ cmStrCat(this->VCTargetsPath, "/Microsoft.Cpp.Unity.targets")));
if (this->GeneratorToolsetCuda.empty()) {
// Find the highest available version of the CUDA tools.
std::vector<std::string> cudaTools;
std::string bcDir;
if (this->GeneratorToolsetCudaCustomDir.empty()) {
- bcDir = this->VCTargetsPath + "/BuildCustomizations";
+ bcDir = cmStrCat(this->VCTargetsPath, "/BuildCustomizations");
} else {
- bcDir = this->GetPlatformToolsetCudaCustomDirString() +
- this->GetPlatformToolsetCudaVSIntegrationSubdirString() +
- "extras\\visual_studio_integration\\MSBuildExtensions";
+ bcDir = cmStrCat(this->GetPlatformToolsetCudaCustomDirString(),
+ this->GetPlatformToolsetCudaVSIntegrationSubdirString(),
+ "extras\\visual_studio_integration\\MSBuildExtensions");
cmSystemTools::ConvertToUnixSlashes(bcDir);
}
cmsys::Glob gl;
gl.SetRelative(bcDir.c_str());
- if (gl.FindFiles(bcDir + "/CUDA *.props")) {
+ if (gl.FindFiles(cmStrCat(bcDir, "/CUDA *.props"))) {
cudaTools = gl.GetFiles();
}
if (!cudaTools.empty()) {
@@ -169,18 +171,19 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
} else if (!this->GeneratorToolsetCudaCustomDir.empty()) {
// Generate an error if Visual Studio integration files are not found
// inside of custom cuda toolset.
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset\n"
- " cuda=" << this->GeneratorToolsetCudaCustomDir << "\n"
- "cannot detect Visual Studio integration files in path\n"
- " " << bcDir;
-
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset\n"
+ " cuda=",
+ this->GeneratorToolsetCudaCustomDir,
+ "\n"
+ "cannot detect Visual Studio integration files in path\n"
+ " ",
+ bcDir));
// Clear the configured tool-set
this->GeneratorToolsetCuda.clear();
@@ -195,25 +198,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
std::string versionToolset = this->GeneratorToolsetVersion;
cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]");
if (regex.find(versionToolset)) {
- versionToolset = "v" + versionToolset.erase(2, 1);
+ versionToolset = cmStrCat("v", versionToolset.erase(2, 1));
} else {
// Version not recognized. Clear it.
versionToolset.clear();
}
if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset and version specification\n"
- " " << this->GetPlatformToolsetString() << ",version=" <<
- this->GeneratorToolsetVersion << "\n"
- "contains an invalid version specification."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset and version specification\n"
+ " ",
+ this->GetPlatformToolsetString(),
+ ",version=", this->GeneratorToolsetVersion,
+ "\n"
+ "contains an invalid version specification."));
// Clear the configured tool-set
this->GeneratorToolsetVersion.clear();
@@ -233,40 +235,40 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
this->GeneratorToolsetVersionProps = std::move(auxProps);
break;
case AuxToolset::PropsMissing: {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset and version specification\n"
- " " << this->GetPlatformToolsetString() << ",version=" <<
- this->GeneratorToolsetVersion << "\n"
- "does not seem to be installed at\n" <<
- " " << auxProps;
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset and version specification\n"
+ " ",
+ this->GetPlatformToolsetString(),
+ ",version=", this->GeneratorToolsetVersion,
+ "\n"
+ "does not seem to be installed at\n"
+ " ",
+ auxProps));
// Clear the configured tool-set
this->GeneratorToolsetVersion.clear();
this->GeneratorToolsetVersionProps = {};
} break;
case AuxToolset::PropsIndeterminate: {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset and version specification\n"
- " " << this->GetPlatformToolsetString() << ",version=" <<
- this->GeneratorToolsetVersion << "\n"
- "has multiple matches installed at\n" <<
- " " << auxProps << "\n" <<
- "The toolset and version specification must resolve \n" <<
- "to a single installed toolset";
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset and version specification\n"
+ " ",
+ this->GetPlatformToolsetString(),
+ ",version=", this->GeneratorToolsetVersion,
+ "\n"
+ "has multiple matches installed at\n",
+ " ", auxProps, "\n",
+ "The toolset and version specification must resolve \n"
+ "to a single installed toolset"));
// Clear the configured tool-set
this->GeneratorToolsetVersion.clear();
@@ -320,47 +322,47 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
for (; fi != fields.end(); ++fi) {
std::string::size_type pos = fi->find('=');
if (pos == fi->npos) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset specification\n"
- " " << ts << "\n"
- "that contains a field after the first ',' with no '='."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset specification\n"
+ " ",
+ ts,
+ "\n"
+ "that contains a field after the first ',' with no '='."));
return false;
}
std::string const key = fi->substr(0, pos);
std::string const value = fi->substr(pos + 1);
if (!handled.insert(key).second) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset specification\n"
- " " << ts << "\n"
- "that contains duplicate field key '" << key << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset specification\n"
+ " ",
+ ts,
+ "\n"
+ "that contains duplicate field key '",
+ key, "'."));
return false;
}
if (!this->ProcessGeneratorToolsetField(key, value)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given toolset specification\n"
- " " << ts << "\n"
- "that contains invalid field '" << *fi << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given toolset specification\n"
+ " ",
+ ts,
+ "\n"
+ "that contains invalid field '",
+ *fi, "'."));
return false;
}
}
@@ -436,11 +438,10 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
}
} else if (this->SystemName == "Android"_s) {
if (this->PlatformInGeneratorName) {
- std::ostringstream e;
- e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR "
- "specifies a platform too: '"
- << this->GetName() << "'";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ",
+ "specifies a platform too: '", this->GetName(), "'"));
return false;
}
if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") ==
@@ -467,11 +468,10 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*)
bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
{
if (this->PlatformInGeneratorName) {
- std::ostringstream e;
- e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
- "specifies a platform too: '"
- << this->GetName() << "'";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ",
+ "specifies a platform too: '", this->GetName(), "'"));
return false;
}
@@ -489,17 +489,17 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
{
- std::ostringstream e;
- e << this->GetName() << " does not support Windows Phone.";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(this->GetName(), " does not support Windows Phone."));
return false;
}
bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
{
- std::ostringstream e;
- e << this->GetName() << " does not support Windows Store.";
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(this->GetName(), " does not support Windows Store."));
return false;
}
@@ -611,29 +611,30 @@ void cmGlobalVisualStudio10Generator::Generate()
}
if (this->LongestSource.Length > 0) {
cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
- std::ostringstream e;
- /* clang-format off */
- e <<
- "The binary and/or source directory paths may be too long to generate "
- "Visual Studio 10 files for this project. "
- "Consider choosing shorter directory names to build this project with "
- "Visual Studio 10. "
- "A more detailed explanation follows."
- "\n"
- "There is a bug in the VS 10 IDE that renders property dialog fields "
- "blank for files referenced by full path in the project file. "
- "However, CMake must reference at least one file by full path:\n"
- " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
- "This is because some Visual Studio tools would append the relative "
- "path to the end of the referencing directory path, as in:\n"
- " " << lg->GetCurrentBinaryDirectory() << "/"
- << this->LongestSource.SourceRel << "\n"
- "and then incorrectly complain that the file does not exist because "
- "the path length is too long for some internal buffer or API. "
- "To avoid this problem CMake must use a full path for this file "
- "which then triggers the VS 10 property dialog bug.";
- /* clang-format on */
- lg->IssueMessage(MessageType::WARNING, e.str());
+ lg->IssueMessage(
+ MessageType::WARNING,
+ cmStrCat(
+ "The binary and/or source directory paths may be too long to generate "
+ "Visual Studio 10 files for this project. "
+ "Consider choosing shorter directory names to build this project with "
+ "Visual Studio 10. "
+ "A more detailed explanation follows."
+ "\n"
+ "There is a bug in the VS 10 IDE that renders property dialog fields "
+ "blank for files referenced by full path in the project file. "
+ "However, CMake must reference at least one file by full path:\n"
+ " ",
+ this->LongestSource.SourceFile->GetFullPath(),
+ "\n"
+ "This is because some Visual Studio tools would append the relative "
+ "path to the end of the referencing directory path, as in:\n"
+ " ",
+ lg->GetCurrentBinaryDirectory(), '/', this->LongestSource.SourceRel,
+ "\n"
+ "and then incorrectly complain that the file does not exist because "
+ "the path length is too long for some internal buffer or API. "
+ "To avoid this problem CMake must use a full path for this file "
+ "which then triggers the VS 10 property dialog bug."));
}
if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue(
"CMAKE_VS_NUGET_PACKAGE_RESTORE")) {
@@ -851,7 +852,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
wd += cmVersion::GetCMakeVersion();
// We record the result persistently in a file.
- std::string const txt = wd + "/VCTargetsPath.txt";
+ std::string const txt = cmStrCat(wd, "/VCTargetsPath.txt");
// If we have a recorded result, use it.
{
@@ -865,8 +866,8 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
// Prepare the work directory.
if (!cmSystemTools::MakeDirectory(wd)) {
- std::string e = "Failed to make directory:\n " + wd;
- mf->IssueMessage(MessageType::FATAL_ERROR, e);
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Failed to make directory:\n ", wd));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
@@ -874,7 +875,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
// Generate a project file for MSBuild to tell us the VCTargetsPath value.
std::string const vcxproj = "VCTargetsPath.vcxproj";
{
- std::string const vcxprojAbs = wd + "/" + vcxproj;
+ std::string const vcxprojAbs = cmStrCat(wd, "/", vcxproj);
cmsys::ofstream fout(vcxprojAbs.c_str());
cmXMLWriter xw(fout);
@@ -893,7 +894,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
cmXMLElement eig(eprj, "ItemGroup");
eig.Attribute("Label", "ProjectConfigurations");
cmXMLElement epc(eig, "ProjectConfiguration");
- epc.Attribute("Include", "Debug|" + this->GetPlatformName());
+ epc.Attribute("Include", cmStrCat("Debug|", this->GetPlatformName()));
cmXMLElement(epc, "Configuration").Content("Debug");
cmXMLElement(epc, "Platform").Content(this->GetPlatformName());
}
@@ -976,8 +977,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
cmd.push_back(vcxproj);
cmd.push_back("/p:Configuration=Debug");
cmd.push_back(cmStrCat("/p:Platform=", this->GetPlatformName()));
- cmd.push_back(std::string("/p:VisualStudioVersion=") +
- this->GetIDEVersion());
+ cmd.push_back(cmStrCat("/p:VisualStudioVersion=", this->GetIDEVersion()));
std::string out;
int ret = 0;
cmsys::RegularExpression regex("\n *VCTargetsPath=([^%\r\n]+)[\r\n]");
@@ -1108,7 +1108,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
requiresRestore = false;
} else if (cmValue cached =
this->CMakeInstance->GetState()->GetCacheEntryValue(
- tname + "_REQUIRES_VS_PACKAGE_RESTORE")) {
+ cmStrCat(tname, "_REQUIRES_VS_PACKAGE_RESTORE"))) {
requiresRestore = cached.IsOn();
} else {
// There are no package references defined.
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 84fa378..0ec5e8b 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -3,7 +3,6 @@
#include "cmGlobalVisualStudio11Generator.h"
#include <cstring>
-#include <sstream>
#include <utility>
#include <vector>
@@ -38,17 +37,18 @@ void cmGlobalVisualStudio11Generator::EnableLanguage(
bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) {
- std::ostringstream e;
+ std::string e;
if (this->DefaultPlatformToolset.empty()) {
- e << this->GetName() << " supports Windows Phone '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ e = cmStrCat(this->GetName(), " supports Windows Phone '8.0', but not '",
+ this->SystemVersion, "'. Check CMAKE_SYSTEM_VERSION.");
} else {
- e << "A Windows Phone component with CMake requires both the Windows "
- "Desktop SDK as well as the Windows Phone '"
- << this->SystemVersion
- << "' SDK. Please make sure that you have both installed";
+ e = cmStrCat(
+ "A Windows Phone component with CMake requires both the Windows "
+ "Desktop SDK as well as the Windows Phone '",
+ this->SystemVersion,
+ "' SDK. Please make sure that you have both installed");
}
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
return true;
@@ -57,17 +57,18 @@ bool cmGlobalVisualStudio11Generator::InitializeWindowsPhone(cmMakefile* mf)
bool cmGlobalVisualStudio11Generator::InitializeWindowsStore(cmMakefile* mf)
{
if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) {
- std::ostringstream e;
+ std::string e;
if (this->DefaultPlatformToolset.empty()) {
- e << this->GetName() << " supports Windows Store '8.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ e = cmStrCat(this->GetName(), " supports Windows Store '8.0', but not '",
+ this->SystemVersion, "'. Check CMAKE_SYSTEM_VERSION.");
} else {
- e << "A Windows Store component with CMake requires both the Windows "
- "Desktop SDK as well as the Windows Store '"
- << this->SystemVersion
- << "' SDK. Please make sure that you have both installed";
+ e = cmStrCat(
+ "A Windows Store component with CMake requires both the Windows "
+ "Desktop SDK as well as the Windows Store '",
+ this->SystemVersion,
+ "' SDK. Please make sure that you have both installed");
}
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
return true;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 3c15bd8..6c72c5d 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -65,7 +65,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
- return { std::string(vs12generatorName) + " [arch]",
+ return { cmStrCat(vs12generatorName, " [arch]"),
"Deprecated. Generates Visual Studio 2013 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"." };
}
@@ -80,8 +80,8 @@ public:
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
{
std::vector<std::string> names;
- names.push_back(vs12generatorName + std::string(" ARM"));
- names.push_back(vs12generatorName + std::string(" Win64"));
+ names.push_back(cmStrCat(vs12generatorName, " ARM"));
+ names.push_back(cmStrCat(vs12generatorName, " Win64"));
return names;
}
@@ -151,19 +151,20 @@ bool cmGlobalVisualStudio12Generator::ProcessGeneratorToolsetField(
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) {
- std::ostringstream e;
+ std::string e;
if (this->DefaultPlatformToolset.empty()) {
- e << this->GetName()
- << " supports Windows Phone '8.0' and '8.1', but "
- "not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ e = cmStrCat(this->GetName(),
+ " supports Windows Phone '8.0' and '8.1', but "
+ "not '",
+ this->SystemVersion, "'. Check CMAKE_SYSTEM_VERSION.");
} else {
- e << "A Windows Phone component with CMake requires both the Windows "
- "Desktop SDK as well as the Windows Phone '"
- << this->SystemVersion
- << "' SDK. Please make sure that you have both installed";
+ e = cmStrCat(
+ "A Windows Phone component with CMake requires both the Windows "
+ "Desktop SDK as well as the Windows Phone '",
+ this->SystemVersion,
+ "' SDK. Please make sure that you have both installed");
}
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
return true;
@@ -172,19 +173,20 @@ bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
bool cmGlobalVisualStudio12Generator::InitializeWindowsStore(cmMakefile* mf)
{
if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) {
- std::ostringstream e;
+ std::string e;
if (this->DefaultPlatformToolset.empty()) {
- e << this->GetName()
- << " supports Windows Store '8.0' and '8.1', but "
- "not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ e = cmStrCat(this->GetName(),
+ " supports Windows Store '8.0' and '8.1', but "
+ "not '",
+ this->SystemVersion, "'. Check CMAKE_SYSTEM_VERSION.");
} else {
- e << "A Windows Store component with CMake requires both the Windows "
- "Desktop SDK as well as the Windows Store '"
- << this->SystemVersion
- << "' SDK. Please make sure that you have both installed";
+ e = cmStrCat(
+ "A Windows Store component with CMake requires both the Windows "
+ "Desktop SDK as well as the Windows Store '",
+ this->SystemVersion,
+ "' SDK. Please make sure that you have both installed");
}
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
return true;
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 7cb5a66..d6a11df 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -67,7 +67,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
- return { std::string(vs14generatorName) + " [arch]",
+ return { cmStrCat(vs14generatorName, " [arch]"),
"Generates Visual Studio 2015 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"." };
}
@@ -82,8 +82,8 @@ public:
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
{
std::vector<std::string> names;
- names.push_back(vs14generatorName + std::string(" ARM"));
- names.push_back(vs14generatorName + std::string(" Win64"));
+ names.push_back(cmStrCat(vs14generatorName, " ARM"));
+ names.push_back(cmStrCat(vs14generatorName, " Win64"));
return names;
}
@@ -173,20 +173,21 @@ bool cmGlobalVisualStudio14Generator::VerifyNoGeneratorPlatformVersion(
bool cmGlobalVisualStudio14Generator::InitializeWindowsStore(cmMakefile* mf)
{
- std::ostringstream e;
if (!this->SelectWindowsStoreToolset(this->DefaultPlatformToolset)) {
+ std::string e;
if (this->DefaultPlatformToolset.empty()) {
- e << this->GetName()
- << " supports Windows Store '8.0', '8.1' and "
- "'10.0', but not '"
- << this->SystemVersion << "'. Check CMAKE_SYSTEM_VERSION.";
+ e = cmStrCat(this->GetName(),
+ " supports Windows Store '8.0', '8.1' and "
+ "'10.0', but not '",
+ this->SystemVersion, "'. Check CMAKE_SYSTEM_VERSION.");
} else {
- e << "A Windows Store component with CMake requires both the Windows "
- "Desktop SDK as well as the Windows Store '"
- << this->SystemVersion
- << "' SDK. Please make sure that you have both installed";
+ e = cmStrCat(
+ "A Windows Store component with CMake requires both the Windows "
+ "Desktop SDK as well as the Windows Store '",
+ this->SystemVersion,
+ "' SDK. Please make sure that you have both installed");
}
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR, e);
return false;
}
return true;
@@ -252,10 +253,11 @@ void cmGlobalVisualStudio14Generator::SetWindowsTargetPlatformVersion(
this->WindowsTargetPlatformVersion = version;
if (!cmSystemTools::VersionCompareEqual(this->WindowsTargetPlatformVersion,
this->SystemVersion)) {
- std::ostringstream e;
- e << "Selecting Windows SDK version " << this->WindowsTargetPlatformVersion
- << " to target Windows " << this->SystemVersion << ".";
- mf->DisplayStatus(e.str(), -1);
+ mf->DisplayStatus(cmStrCat("Selecting Windows SDK version ",
+ this->WindowsTargetPlatformVersion,
+ " to target Windows ", this->SystemVersion,
+ "."),
+ -1);
}
mf->AddDefinition("CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION",
this->WindowsTargetPlatformVersion);
@@ -335,7 +337,7 @@ struct NoWindowsH
{
bool operator()(std::string const& p)
{
- return !cmSystemTools::FileExists(p + "/um/windows.h", true);
+ return !cmSystemTools::FileExists(cmStrCat(p, "/um/windows.h"), true);
}
};
class WindowsSDKTooRecent
@@ -402,7 +404,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion(
std::vector<std::string> sdks;
// Grab the paths of the different SDKs that are installed
for (std::string const& i : win10Roots) {
- std::string path = i + "/Include/*";
+ std::string path = cmStrCat(i, "/Include/*");
cmSystemTools::GlobDirs(path, sdks);
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 01f4803..98176b0 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -209,8 +209,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
cmList mapConfig;
const char* dstConfig = i.c_str();
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
- if (cmValue m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
- cmSystemTools::UpperCase(i))) {
+ if (cmValue m = target.GetProperty(
+ cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) {
mapConfig.assign(*m);
if (!mapConfig.empty()) {
dstConfig = mapConfig[0].c_str();
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 67e0a29..80a7be8 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -158,7 +158,7 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
std::string vskey;
// Search in standard location.
- vskey = this->GetRegistryBase() + ";InstallDir";
+ vskey = cmStrCat(this->GetRegistryBase(), ";InstallDir");
if (cmSystemTools::ReadRegistryValue(vskey, vscmd,
cmSystemTools::KeyWOW64_32)) {
cmSystemTools::ConvertToUnixSlashes(vscmd);
@@ -259,7 +259,7 @@ cmGlobalVisualStudio7Generator::GenerateBuildCommand(
GeneratedMakeCommand makeCommand;
makeCommand.RequiresOutputForward = requiresOutputForward;
makeCommand.Add(makeProgramSelected);
- makeCommand.Add(projectName + ".sln");
+ makeCommand.Add(cmStrCat(projectName, ".sln"));
makeCommand.Add((clean ? "/clean" : "/build"));
makeCommand.Add((config.empty() ? "Debug" : config));
makeCommand.Add("/project");
@@ -483,12 +483,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
}
if (cumulativePath.empty()) {
- cumulativePath = "CMAKE_FOLDER_GUID_" + iter;
+ cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter);
} else {
- VisualStudioFolders[cumulativePath].insert(cumulativePath + "/" +
- iter);
+ VisualStudioFolders[cumulativePath].insert(
+ cmStrCat(cumulativePath, "/", iter));
- cumulativePath = cumulativePath + "/" + iter;
+ cumulativePath = cmStrCat(cumulativePath, "/", iter);
}
}
@@ -552,7 +552,8 @@ std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
std::ostream& fout, cmLocalGenerator* root)
{
- std::string const guid = this->GetGUID(root->GetProjectName() + ".sln");
+ std::string const guid =
+ this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
bool extensibilityGlobalsOverridden = false;
bool extensibilityAddInsOverridden = false;
const std::vector<std::string> propKeys =
@@ -680,7 +681,7 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
{
- std::string const& guidStoreName = name + "_GUID_CMAKE";
+ std::string const& guidStoreName = cmStrCat(name, "_GUID_CMAKE");
if (cmValue storedGUID =
this->CMakeInstance->GetCacheDefinition(guidStoreName)) {
return *storedGUID;
@@ -705,9 +706,7 @@ void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
const std::string& suffix, std::string& dir)
{
if (!config.empty()) {
- dir += prefix;
- dir += config;
- dir += suffix;
+ dir += cmStrCat(prefix, config, suffix);
}
}
@@ -728,7 +727,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
// check if target <t> is part of default build
if (target->GetName() == t) {
const std::string propertyName =
- "CMAKE_VS_INCLUDE_" + t + "_TO_DEFAULT_BUILD";
+ cmStrCat("CMAKE_VS_INCLUDE_", t, "_TO_DEFAULT_BUILD");
// inspect CMAKE_VS_INCLUDE_<t>_TO_DEFAULT_BUILD properties
for (std::string const& i : configs) {
cmValue propertyValue =
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index acb20d1..a2a7cb1 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -341,7 +341,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
std::string argS = cmStrCat("-S", lg.GetSourceDirectory());
std::string argB = cmStrCat("-B", lg.GetBinaryDirectory());
std::string const sln =
- lg.GetBinaryDirectory() + "/" + lg.GetProjectName() + ".sln";
+ cmStrCat(lg.GetBinaryDirectory(), "/", lg.GetProjectName(), ".sln");
cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
{ cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list",
stampList, "--vs-solution-file", sln });
@@ -364,7 +364,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
lg.AddCustomCommandToOutput(std::move(cc), true)) {
gt->AddSource(file->ResolveFullPath());
} else {
- cmSystemTools::Error("Error adding rule for " + stamps[0]);
+ cmSystemTools::Error(cmStrCat("Error adding rule for ", stamps[0]));
}
}
@@ -409,8 +409,8 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
cmList mapConfig;
const char* dstConfig = i.c_str();
if (target.GetProperty("EXTERNAL_MSPROJECT")) {
- if (cmValue m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
- cmSystemTools::UpperCase(i))) {
+ if (cmValue m = target.GetProperty(
+ cmStrCat("MAP_IMPORTED_CONFIG_", cmSystemTools::UpperCase(i)))) {
mapConfig.assign(*m);
if (!mapConfig.empty()) {
dstConfig = mapConfig[0].c_str();
diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx
index e396405..462db2a 100644
--- a/Source/cmGlobalVisualStudio9Generator.cxx
+++ b/Source/cmGlobalVisualStudio9Generator.cxx
@@ -9,6 +9,7 @@
#include "cmGlobalGenerator.h"
#include "cmGlobalGeneratorFactory.h"
#include "cmGlobalVisualStudioGenerator.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVisualStudioWCEPlatformParser.h"
@@ -63,7 +64,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
- return { std::string(vs9generatorName) + " [arch]",
+ return { cmStrCat(vs9generatorName, " [arch]"),
"Deprecated. Generates Visual Studio 2008 project files. "
"Optional [arch] can be \"Win64\" or \"IA64\"." };
}
@@ -78,14 +79,14 @@ public:
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
{
std::vector<std::string> names;
- names.push_back(vs9generatorName + std::string(" Win64"));
- names.push_back(vs9generatorName + std::string(" IA64"));
+ names.push_back(cmStrCat(vs9generatorName, " Win64"));
+ names.push_back(cmStrCat(vs9generatorName, " IA64"));
cmVisualStudioWCEPlatformParser parser;
parser.ParseVersion("9.0");
const std::vector<std::string>& availablePlatforms =
parser.GetAvailablePlatforms();
for (std::string const& i : availablePlatforms) {
- names.push_back("Visual Studio 9 2008 " + i);
+ names.push_back(cmStrCat("Visual Studio 9 2008 ", i));
}
return names;
}
@@ -144,7 +145,7 @@ std::string cmGlobalVisualStudio9Generator::GetUserMacrosDirectory()
cmSystemTools::ConvertToUnixSlashes(base);
// 9.0 macros folder:
- path = base + "/VSMacros80";
+ path = cmStrCat(base, "/VSMacros80");
// *NOT* a typo; right now in Visual Studio 2008 beta the macros
// folder is VSMacros80... They may change it to 90 before final
// release of 2008 or they may not... we'll have to keep our eyes
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index ad93b6c..be5b79f 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -185,8 +185,8 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase()
std::string cmGlobalVisualStudioGenerator::GetRegistryBase(const char* version)
{
- std::string key = R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)";
- return key + version;
+ return cmStrCat(R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)",
+ version);
}
void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
@@ -275,7 +275,7 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
std::string src = cmStrCat(cmSystemTools::GetCMakeRoot(),
"/Templates/" CMAKE_VSMACROS_FILENAME);
- std::string dst = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
+ std::string dst = cmStrCat(dir, "/CMakeMacros/" CMAKE_VSMACROS_FILENAME);
// Copy the macros file to the user directory only if the
// destination does not exist or the source location is newer.
@@ -310,7 +310,8 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro(
// - there were .sln/.vcproj files changed during generation
//
if (!dir.empty()) {
- std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
+ std::string macrosFile =
+ cmStrCat(dir, "/CMakeMacros/" CMAKE_VSMACROS_FILENAME);
std::string nextSubkeyName;
if (cmSystemTools::FileExists(macrosFile) &&
IsVisualStudioMacrosFileRegistered(
@@ -519,9 +520,9 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName(
}
root->GetMakefile()->IssueMessage(
MessageType::AUTHOR_WARNING,
- "Directory property VS_STARTUP_PROJECT specifies target "
- "'" +
- startup + "' that does not exist. Ignoring.");
+ cmStrCat("Directory property VS_STARTUP_PROJECT specifies target "
+ "'",
+ startup, "' that does not exist. Ignoring."));
}
// default, if not specified
@@ -547,7 +548,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
LONG result = ERROR_SUCCESS;
DWORD index = 0;
- keyname = regKeyBase + "\\OtherProjects7";
+ keyname = cmStrCat(regKeyBase, "\\OtherProjects7");
hkey = nullptr;
result =
RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(),
@@ -639,7 +640,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
// as the name of the next subkey.
nextAvailableSubKeyName = std::to_string(index);
- keyname = regKeyBase + "\\RecordingProject7";
+ keyname = cmStrCat(regKeyBase, "\\RecordingProject7");
hkey = nullptr;
result =
RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(),
@@ -685,7 +686,7 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName,
const std::string& macrosFile,
const std::string& regKeyBase)
{
- std::string keyname = regKeyBase + "\\OtherProjects7";
+ std::string keyname = cmStrCat(regKeyBase, "\\OtherProjects7");
HKEY hkey = nullptr;
LONG result =
RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(),
@@ -906,10 +907,10 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
cmSystemTools::ReplaceString(obj_dir_expanded, this->GetCMakeCFGIntDir(),
configName.c_str());
cmSystemTools::MakeDirectory(obj_dir_expanded);
- std::string const objs_file = obj_dir_expanded + "/objects.txt";
+ std::string const objs_file = cmStrCat(obj_dir_expanded, "/objects.txt");
cmGeneratedFileStream fout(objs_file.c_str());
if (!fout) {
- cmSystemTools::Error("could not open " + objs_file);
+ cmSystemTools::Error(cmStrCat("could not open ", objs_file));
return;
}
@@ -920,7 +921,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
// It must exist because we populated the mapping just above.
const auto& v = mapping[it];
assert(!v.empty());
- std::string objFile = obj_dir + v;
+ std::string objFile = cmStrCat(obj_dir, v);
objs.push_back(objFile);
}
std::vector<cmSourceFile const*> externalObjectSources;
@@ -976,7 +977,7 @@ bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir,
const std::string& projectName,
bool dryRun)
{
- std::string sln = bindir + "/" + projectName + ".sln";
+ std::string sln = cmStrCat(bindir, "/", projectName, ".sln");
if (dryRun) {
return cmSystemTools::FileExists(sln, true);
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 44019f6..8b408a9 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -211,7 +211,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2017")) {
p += 5;
}
- genName = std::string(vs15generatorName) + p;
+ genName = cmStrCat(vs15generatorName, p);
return p;
}
@@ -250,7 +250,7 @@ public:
cmDocumentationEntry GetDocumentation() const override
{
- return { std::string(vs15generatorName) + " [arch]",
+ return { cmStrCat(vs15generatorName, " [arch]"),
"Generates Visual Studio 2017 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"." };
}
@@ -265,8 +265,8 @@ public:
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
{
std::vector<std::string> names;
- names.push_back(vs15generatorName + std::string(" ARM"));
- names.push_back(vs15generatorName + std::string(" Win64"));
+ names.push_back(cmStrCat(vs15generatorName, " ARM"));
+ names.push_back(cmStrCat(vs15generatorName, " Win64"));
return names;
}
@@ -306,7 +306,7 @@ static const char* cmVS16GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2019")) {
p += 5;
}
- genName = std::string(vs16generatorName) + p;
+ genName = cmStrCat(vs16generatorName, p);
return p;
}
@@ -320,7 +320,7 @@ static const char* cmVS17GenName(const std::string& name, std::string& genName)
if (cmHasLiteralPrefix(p, " 2022")) {
p += 5;
}
- genName = std::string(vs17generatorName) + p;
+ genName = cmStrCat(vs17generatorName, p);
return p;
}
@@ -526,18 +526,19 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
cmsys::RegularExpression versionRegex(
cmStrCat("^", majorStr, R"(\.[0-9]+\.[0-9]+\.[0-9]+$)"));
if (!versionRegex.find(this->GeneratorInstanceVersion)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << i << "\n"
- "but the version field is not 4 integer components"
- " starting in " << majorStr << "."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ i,
+ "\n"
+ "but the version field is not 4 integer components"
+ " starting in ",
+ majorStr, "."));
return false;
}
}
@@ -566,14 +567,13 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
return false;
}
} else if (!this->vsSetupAPIHelper.GetVSInstanceInfo(vsInstance)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "could not find any instance of Visual Studio.\n";
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "could not find any instance of Visual Studio.\n"));
return false;
}
@@ -619,47 +619,47 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
for (; fi != fields.end(); ++fi) {
std::string::size_type pos = fi->find('=');
if (pos == fi->npos) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains a field after the first ',' with no '='."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains a field after the first ',' with no '='."));
return false;
}
std::string const key = fi->substr(0, pos);
std::string const value = fi->substr(pos + 1);
if (!handled.insert(key).second) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains duplicate field key '" << key << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains duplicate field key '",
+ key, "'."));
return false;
}
if (!this->ProcessGeneratorInstanceField(key, value)) {
- std::ostringstream e;
- /* clang-format off */
- e <<
- "Generator\n"
- " " << this->GetName() << "\n"
- "given instance specification\n"
- " " << is << "\n"
- "that contains invalid field '" << *fi << "'."
- ;
- /* clang-format on */
- mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
+ mf->IssueMessage(MessageType::FATAL_ERROR,
+ cmStrCat("Generator\n"
+ " ",
+ this->GetName(),
+ "\n"
+ "given instance specification\n"
+ " ",
+ is,
+ "\n"
+ "that contains invalid field '",
+ *fi, "'."));
return false;
}
}
@@ -956,8 +956,8 @@ bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
"Windows Kits\\Installed Roots;KitsRoot81",
win81Root, cmSystemTools::KeyWOW64_32)) {
- return cmSystemTools::FileExists(win81Root + "/include/um/windows.h",
- true);
+ return cmSystemTools::FileExists(
+ cmStrCat(win81Root, "/include/um/windows.h"), true);
}
return false;
}
@@ -990,29 +990,29 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17) {
if (VSIsArm64Host()) {
if (VSHasDotNETFrameworkArm64()) {
- msbuild = vs + "/MSBuild/Current/Bin/arm64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/arm64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
if (VSIsWindows11OrGreater()) {
- msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
} else {
- msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/amd64/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
}
}
- msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/Current/Bin/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
- msbuild = vs + "/MSBuild/15.0/Bin/MSBuild.exe";
+ msbuild = cmStrCat(vs, "/MSBuild/15.0/Bin/MSBuild.exe");
if (cmSystemTools::FileExists(msbuild)) {
return msbuild;
}
@@ -1029,7 +1029,7 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand()
// Ask Visual Studio Installer tool.
std::string vs;
if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) {
- devenv = vs + "/Common7/IDE/devenv.com";
+ devenv = cmStrCat(vs, "/Common7/IDE/devenv.com");
if (cmSystemTools::FileExists(devenv)) {
return devenv;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 24ef5c2..eaa2c2c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -283,7 +283,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
file->ResolveFullPath();
return file;
}
- cmSystemTools::Error("Error adding rule for " + makefileIn);
+ cmSystemTools::Error(cmStrCat("Error adding rule for ", makefileIn));
return nullptr;
}
@@ -673,8 +673,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
: target->GetLinkerLanguage(configName));
if (linkLanguage.empty()) {
cmSystemTools::Error(
- "CMake can not determine linker language for target: " +
- target->GetName());
+ cmStrCat("CMake can not determine linker language for target: ",
+ target->GetName()));
return;
}
langForClCompile = linkLanguage;
@@ -961,7 +961,7 @@ std::string cmLocalVisualStudio7Generator::GetBuildTypeLinkerFlags(
{
std::string configTypeUpper = cmSystemTools::UpperCase(configName);
std::string extraLinkOptionsBuildTypeDef =
- rootLinkerFlags + "_" + configTypeUpper;
+ cmStrCat(rootLinkerFlags, "_", configTypeUpper);
const std::string& extraLinkOptionsBuildType =
this->Makefile->GetRequiredDefinition(extraLinkOptionsBuildTypeDef);
@@ -978,19 +978,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
std::string temp;
std::string extraLinkOptions;
if (target->GetType() == cmStateEnums::EXECUTABLE) {
- extraLinkOptions =
- this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + " " +
- GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName);
+ extraLinkOptions = cmStrCat(
+ this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"), " ",
+ GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName));
}
if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
- extraLinkOptions =
- this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") +
- " " + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName);
+ extraLinkOptions = cmStrCat(
+ this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"), " ",
+ GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName));
}
if (target->GetType() == cmStateEnums::MODULE_LIBRARY) {
- extraLinkOptions =
- this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") +
- " " + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName);
+ extraLinkOptions = cmStrCat(
+ this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"), " ",
+ GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName));
}
cmValue targetLinkFlags = target->GetProperty("LINK_FLAGS");
@@ -1285,7 +1285,8 @@ void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool(
<< "\"/>\n";
if (dir) {
- std::string const exe = *dir + "\\" + target->GetFullName(config);
+ std::string const exe =
+ cmStrCat(*dir, "\\", target->GetFullName(config));
fout << "\t\t\t<DebuggerTool\n"
"\t\t\t\tRemoteExecutable=\""
@@ -1369,8 +1370,9 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(
// First search a configuration-specific subdirectory and then the
// original directory.
fout << comma
- << this->ConvertToXMLOutputPath(dir + "/$(ConfigurationName)") << ","
- << this->ConvertToXMLOutputPath(dir);
+ << this->ConvertToXMLOutputPath(
+ cmStrCat(dir, "/$(ConfigurationName)"))
+ << "," << this->ConvertToXMLOutputPath(dir);
comma = ",";
}
}
@@ -1550,11 +1552,11 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
switch (cmOutputConverter::GetFortranFormat(
sf.GetSafeProperty("Fortran_FORMAT"))) {
case cmOutputConverter::FortranFormatFixed:
- fc.CompileFlags = "-fixed " + fc.CompileFlags;
+ fc.CompileFlags = cmStrCat("-fixed ", fc.CompileFlags);
needfc = true;
break;
case cmOutputConverter::FortranFormatFree:
- fc.CompileFlags = "-free " + fc.CompileFlags;
+ fc.CompileFlags = cmStrCat("-free ", fc.CompileFlags);
needfc = true;
break;
default:
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index 6702b7b..ccf24a0 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -63,15 +63,16 @@ const WCHAR* ComponentType = L"Component";
bool LoadVSInstanceVCToolsetVersion(VSInstanceInfo& vsInstanceInfo)
{
std::string const vcRoot = vsInstanceInfo.GetInstallLocation();
- std::string vcToolsVersionFile =
- vcRoot + "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt";
+ std::string vcToolsVersionFile = cmStrCat(
+ vcRoot, "/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt");
std::string vcToolsVersion;
cmsys::ifstream fin(vcToolsVersionFile.c_str());
if (!fin || !cmSystemTools::GetLineFromStream(fin, vcToolsVersion)) {
return false;
}
vcToolsVersion = cmTrimWhitespace(vcToolsVersion);
- std::string const vcToolsDir = vcRoot + "/VC/Tools/MSVC/" + vcToolsVersion;
+ std::string const vcToolsDir =
+ cmStrCat(vcRoot, "/VC/Tools/MSVC/", vcToolsVersion);
if (!cmSystemTools::FileIsDirectory(vcToolsDir)) {
return false;
}
@@ -434,14 +435,14 @@ bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance()
std::string envVSCommonToolsDir;
std::string envVSCommonToolsDirEnvName =
- "VS" + std::to_string(this->Version) + "0COMNTOOLS";
+ cmStrCat("VS", std::to_string(this->Version), "0COMNTOOLS");
if (cmSystemTools::GetEnv(envVSCommonToolsDirEnvName.c_str(),
envVSCommonToolsDir)) {
cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir);
}
- std::string const wantVersion = std::to_string(this->Version) + '.';
+ std::string const wantVersion = cmStrCat(std::to_string(this->Version), '.');
bool specifiedLocationNotSpecifiedVersion = false;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ddb08ba..b4c55b3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -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);
}
}
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 9bbe34b..80e37bd 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -280,7 +280,7 @@ void cmVisualStudioGeneratorOptions::PrependInheritedString(
return;
}
std::string& value = i->second[0];
- value = "%(" + key + ") " + value;
+ value = cmStrCat("%(", key, ") ", value);
}
void cmVisualStudioGeneratorOptions::Reparse(std::string const& key)
diff --git a/Source/cmVisualStudioSlnData.cxx b/Source/cmVisualStudioSlnData.cxx
index 4b6754e..d824462 100644
--- a/Source/cmVisualStudioSlnData.cxx
+++ b/Source/cmVisualStudioSlnData.cxx
@@ -5,6 +5,7 @@
#include <cstddef>
#include <utility>
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
void cmSlnProjectEntry::AddProjectConfiguration(
@@ -72,7 +73,8 @@ std::string cmSlnData::GetConfigurationTarget(
const std::string& projectName, const std::string& solutionConfiguration,
const std::string& platformName)
{
- std::string solutionTarget = solutionConfiguration + "|" + platformName;
+ std::string solutionTarget =
+ cmStrCat(solutionConfiguration, "|", platformName);
cm::optional<cmSlnProjectEntry> project = GetProjectByName(projectName);
if (!project) {
return platformName;
diff --git a/Source/cmVisualStudioSlnParser.cxx b/Source/cmVisualStudioSlnParser.cxx
index 76791a6..9b61566 100644
--- a/Source/cmVisualStudioSlnParser.cxx
+++ b/Source/cmVisualStudioSlnParser.cxx
@@ -83,7 +83,7 @@ bool cmVisualStudioSlnParser::ParsedLine::IsKeyValuePair() const
std::string cmVisualStudioSlnParser::ParsedLine::GetArgVerbatim() const
{
if (this->Arg.second) {
- return Quote + this->Arg.first + Quote;
+ return cmStrCat(Quote, this->Arg.first, Quote);
}
return this->Arg.first;
}
@@ -103,7 +103,7 @@ std::string cmVisualStudioSlnParser::ParsedLine::GetValueVerbatim(
if (idxValue < this->Values.size()) {
const StringData& data = this->Values[idxValue];
if (data.second) {
- return Quote + data.first + Quote;
+ return cmStrCat(Quote, data.first, Quote);
}
return data.first;
}
@@ -546,7 +546,7 @@ bool cmVisualStudioSlnParser::ParseBOM(std::istream& input, std::string& line,
return false;
}
if (!this->LastResult.HadBOM) {
- line = bom + line; // it wasn't a BOM, prepend it to first line
+ line = cmStrCat(bom, line); // it wasn't a BOM, prepend it to first line
}
return true;
}
diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx
index 19c8d35..aa7aae7 100644
--- a/Source/cmVisualStudioWCEPlatformParser.cxx
+++ b/Source/cmVisualStudioWCEPlatformParser.cxx
@@ -7,14 +7,15 @@
#include <utility>
#include "cmGlobalVisualStudioGenerator.h"
+#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
{
const std::string registryBase =
cmGlobalVisualStudioGenerator::GetRegistryBase(version);
- const std::string vckey = registryBase + "\\Setup\\VC;ProductDir";
- const std::string vskey = registryBase + "\\Setup\\VS;ProductDir";
+ const std::string vckey = cmStrCat(registryBase, "\\Setup\\VC;ProductDir");
+ const std::string vskey = cmStrCat(registryBase, "\\Setup\\VS;ProductDir");
if (!cmSystemTools::ReadRegistryValue(vckey, this->VcInstallDir,
cmSystemTools::KeyWOW64_32) ||
@@ -28,7 +29,7 @@ int cmVisualStudioWCEPlatformParser::ParseVersion(const char* version)
this->VsInstallDir.append("/");
const std::string configFilename =
- this->VcInstallDir + "vcpackages/WCE.VCPlatform.config";
+ cmStrCat(this->VcInstallDir, "vcpackages/WCE.VCPlatform.config");
return this->ParseFile(configFilename.c_str());
}
@@ -39,7 +40,7 @@ std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const
return OSMajorVersion;
}
- return OSMajorVersion + "." + OSMinorVersion;
+ return cmStrCat(OSMajorVersion, ".", OSMinorVersion);
}
const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const