Merge topic 'reduce-realloc-clang-tidy-part3'

0aa1eaf506 Source: Reduce string allocations, part 4
1d2f0120be Source: Reduce string allocations, part 3
cb20c5bd89 Source: Reduce string allocations, part 2

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12538
This commit is contained in:
Brad King
2026-09-23 13:30:55 -04:00
committed by Kitware Robot
76 changed files with 366 additions and 313 deletions
+22 -18
View File
@@ -106,7 +106,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
std::string ifwArg = (*it)->Name;
++it;
while (it != this->DownloadedPackages.end()) {
ifwArg += "," + (*it)->Name;
ifwArg = cmStrCat(ifwArg, ',', (*it)->Name);
++it;
}
ifwCmd.emplace_back(ifwArg);
@@ -200,7 +200,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
ifwArg = path + *it;
++it;
while (it != this->Installer.Resources.end()) {
ifwArg += "," + path + *it;
ifwArg = cmStrCat(ifwArg, ',', path, *it);
++it;
}
ifwCmd.emplace_back(ifwArg);
@@ -241,7 +241,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
ifwArg = (*it)->Name;
++it;
while (it != this->DownloadedPackages.end()) {
ifwArg += "," + (*it)->Name;
ifwArg = cmStrCat(ifwArg, ',', (*it)->Name);
++it;
}
ifwCmd.emplace_back(ifwArg);
@@ -251,7 +251,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
// Binary
auto bit = this->BinaryPackages.begin();
while (bit != this->BinaryPackages.end()) {
ifwArg += (*bit)->Name + ",";
ifwArg = cmStrCat(ifwArg, (*bit)->Name, ',');
++bit;
}
// Depend
@@ -259,7 +259,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildBinaryCreatorCommand()
ifwArg += it->second.Name;
++it;
while (it != this->DependentPackages.end()) {
ifwArg += "," + it->second.Name;
ifwArg = cmStrCat(ifwArg, ',', it->second.Name);
++it;
}
ifwCmd.emplace_back(ifwArg);
@@ -310,7 +310,8 @@ char const* cmCPackIFWGenerator::GetPackagingInstallPrefix()
std::string tmpPref = defPrefix ? defPrefix : "";
if (this->Components.empty()) {
tmpPref += "packages/" + this->GetRootPackageName() + "/data";
tmpPref =
cmStrCat(tmpPref, "packages/", this->GetRootPackageName(), "/data");
}
this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref);
@@ -471,8 +472,9 @@ std::string cmCPackIFWGenerator::GetComponentInstallSuffix(
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
}
return prefix +
this->GetComponentPackageName(&this->Components[componentName]) + suffix;
return cmStrCat(
prefix, this->GetComponentPackageName(&this->Components[componentName]),
suffix);
}
std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
@@ -485,10 +487,11 @@ std::string cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
return cmStrCat(prefix, this->GetRootPackageName(), suffix);
}
return prefix +
return cmStrCat(
prefix,
this->GetSanitizedDirOrFileName(
this->GetComponentPackageName(&this->Components[componentName])) +
suffix;
this->GetComponentPackageName(&this->Components[componentName])),
suffix);
}
cmCPackComponent* cmCPackIFWGenerator::GetComponent(
@@ -624,15 +627,15 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
if (cmCPackIFWPackage* package = this->GetGroupPackage(group)) {
return package->Name;
}
cmValue option =
this->GetOption("CPACK_IFW_COMPONENT_GROUP_" +
cmsys::SystemTools::UpperCase(group->Name) + "_NAME");
cmValue option = this->GetOption(
cmStrCat("CPACK_IFW_COMPONENT_GROUP_",
cmsys::SystemTools::UpperCase(group->Name), "_NAME"));
name = option ? *option : group->Name;
if (group->ParentGroup) {
cmCPackIFWPackage* package = this->GetGroupPackage(group->ParentGroup);
bool dot = !this->ResolveDuplicateNames;
if (dot && !cmHasPrefix(name, package->Name)) {
name = package->Name + "." + name;
name = cmStrCat(package->Name, '.', name);
}
}
return name;
@@ -648,8 +651,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
if (cmCPackIFWPackage* package = this->GetComponentPackage(component)) {
return package->Name;
}
std::string prefix = "CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_";
std::string prefix =
cmStrCat("CPACK_IFW_COMPONENT_",
cmsys::SystemTools::UpperCase(component->Name), '_');
cmValue option = this->GetOption(prefix + "NAME");
name = option ? *option : component->Name;
if (component->Group) {
@@ -661,7 +665,7 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
}
bool dot = !this->ResolveDuplicateNames;
if (dot && !cmHasPrefix(name, package->Name)) {
name = package->Name + "." + name;
name = cmStrCat(package->Name, '.', name);
}
}
return name;
+3 -2
View File
@@ -6,6 +6,7 @@
#include "cmCPackIFWGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
#include "cmXMLParser.h"
@@ -41,8 +42,8 @@ bool cmCPackIFWRepository::ConfigureFromOptions()
return false;
}
std::string prefix =
"CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(this->Name) + "_";
std::string prefix = cmStrCat(
"CPACK_IFW_REPOSITORY_", cmsys::SystemTools::UpperCase(this->Name), '_');
// Update
if (this->IsOn(prefix + "ADD")) {
+7 -5
View File
@@ -80,8 +80,9 @@ int cmCPackAppImageGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Found Desktop file: \"" << desktopFile.value() << "\""
<< std::endl);
std::string desktopSymLink = this->toplevel + "/" +
cmSystemTools::GetFilenameName(desktopFile.value());
std::string desktopSymLink =
cmStrCat(this->toplevel, '/',
cmSystemTools::GetFilenameName(desktopFile.value()));
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Desktop file destination: \"" << desktopSymLink << "\""
<< std::endl);
@@ -139,7 +140,7 @@ int cmCPackAppImageGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Icon file: \"" << *iconFile << "\"" << std::endl);
std::string iconSymLink =
this->toplevel + "/" + cmSystemTools::GetFilenameName(*iconFile);
cmStrCat(this->toplevel, '/', cmSystemTools::GetFilenameName(*iconFile));
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Icon link destination: \"" << iconSymLink << "\""
<< std::endl);
@@ -239,8 +240,9 @@ int cmCPackAppImageGenerator::PackageFiles()
this->AppimagetoolPath,
this->toplevel,
};
command.emplace_back("../" + *this->GetOption("CPACK_PACKAGE_FILE_NAME") +
this->GetOutputExtension());
command.emplace_back(cmStrCat("../",
*this->GetOption("CPACK_PACKAGE_FILE_NAME"),
this->GetOutputExtension()));
auto addOptionFlag = [&command, this](std::string const& op,
std::string commandFlag) {
+14 -10
View File
@@ -286,8 +286,8 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName(
std::string componentUpper(cmSystemTools::UpperCase(component));
std::string packageFileName;
if (cmValue v = this->GetOptionIfSet("CPACK_ARCHIVE_" + componentUpper +
"_FILE_NAME")) {
if (cmValue v = this->GetOptionIfSet(
cmStrCat("CPACK_ARCHIVE_", componentUpper, "_FILE_NAME"))) {
packageFileName += *v;
} else if ((v = this->GetOptionIfSet("CPACK_ARCHIVE_FILE_NAME"))) {
packageFileName +=
@@ -328,8 +328,9 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
" - packaging component: " << component->Name << std::endl);
// Add the files of this component to the archive
std::string localToplevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
localToplevel += "/" + this->GetSanitizedDirOrFileName(component->Name);
std::string localToplevel(
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), '/',
this->GetSanitizedDirOrFileName(component->Name)));
// Change to local toplevel
cmWorkingDirectory workdir(localToplevel);
if (workdir.Failed()) {
@@ -426,8 +427,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Packaging component group: " << compG.first << std::endl);
// Begin the archive for this group
std::string packageFileName = std::string(this->toplevel) + "/" +
this->GetArchiveComponentFileName(compG.first, true);
std::string packageFileName =
cmStrCat(this->toplevel, '/',
this->GetArchiveComponentFileName(compG.first, true));
Deduplicator deduplicator;
@@ -455,8 +457,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
<< "> does not belong to any group, package it separately."
<< std::endl);
std::string packageFileName = std::string(this->toplevel);
packageFileName +=
"/" + this->GetArchiveComponentFileName(comp.first, false);
packageFileName =
cmStrCat(packageFileName, '/',
this->GetArchiveComponentFileName(comp.first, false));
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
@@ -473,8 +476,9 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
else {
for (auto& comp : this->Components) {
std::string packageFileName = std::string(this->toplevel);
packageFileName +=
"/" + this->GetArchiveComponentFileName(comp.first, false);
packageFileName =
cmStrCat(packageFileName, '/',
this->GetArchiveComponentFileName(comp.first, false));
{
DECLARE_AND_OPEN_ARCHIVE(packageFileName, archive);
+7 -6
View File
@@ -520,9 +520,10 @@ bool DebGenerator::generateDeb() const
deb.SetUNAMEAndGNAME("root", "root");
if (!deb.Add(tlDir + "debian-binary", tlDir.length()) ||
!deb.Add(tlDir + "control.tar" + this->CompressionSuffix,
!deb.Add(cmStrCat(tlDir, "control.tar", this->CompressionSuffix),
tlDir.length()) ||
!deb.Add(tlDir + "data.tar" + this->CompressionSuffix, tlDir.length())) {
!deb.Add(cmStrCat(tlDir, "data.tar", this->CompressionSuffix),
tlDir.length())) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error creating debian package:\n"
"#top level directory: "
@@ -919,8 +920,8 @@ bool cmCPackDebGenerator::createDbgsymDDeb()
controlValues["Version"] = *debian_pkg_version;
controlValues["Auto-Built-Package"] = "debug-symbols";
controlValues["Depends"] =
*this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_NAME") + std::string(" (= ") +
*debian_pkg_version + ")";
cmStrCat(*this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_NAME"),
" (= ", *debian_pkg_version, ')');
controlValues["Section"] = "debug";
controlValues["Priority"] = "optional";
controlValues["Architecture"] =
@@ -973,8 +974,8 @@ std::string cmCPackDebGenerator::GetComponentInstallSuffix(
}
// We have to find the name of the COMPONENT GROUP
// the current COMPONENT belongs to.
std::string groupVar =
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
std::string groupVar = cmStrCat(
"CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP");
if (cmValue v = this->GetOption(groupVar)) {
return *v;
}
+14 -11
View File
@@ -114,7 +114,7 @@ int cmCPackGenerator::PrepareNames()
// Determine temporary packaging-directory.
std::string tmpDirectory = cmStrCat(topDirectory, '/', pkgBaseFileName);
// Determine path to temporary package file.
std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName;
std::string tmpPkgFilePath = cmStrCat(topDirectory, '/', pkgFileName);
// Set CPack variables which are not set already.
this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
@@ -620,8 +620,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
if (this->SupportsComponentInstallation() &&
!(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) {
// Determine the installation types for this project (if provided).
std::string installTypesVar = "CPACK_" +
cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
std::string installTypesVar =
cmStrCat("CPACK_", cmSystemTools::UpperCase(project.Component),
"_INSTALL_TYPES");
cmValue installTypes = this->GetOption(installTypesVar);
if (!installTypes.IsEmpty()) {
cmList installTypesList{ installTypes };
@@ -837,7 +838,7 @@ int cmCPackGenerator::InstallCMakeProject(
if (cmHasPrefix(dir, '/')) {
dir = tempInstallDirectory + dir;
} else {
dir = tempInstallDirectory + "/" + dir;
dir = cmStrCat(tempInstallDirectory, '/', dir);
}
/*
* We must re-set DESTDIR for each component
@@ -987,8 +988,8 @@ int cmCPackGenerator::InstallCMakeProject(
// define component specific var
if (componentInstall) {
std::string absoluteDestFileComponent =
std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" +
this->GetComponentInstallSuffix(component);
cmStrCat("CPACK_ABSOLUTE_DESTINATION_FILES_",
this->GetComponentInstallSuffix(component));
if (cmValue v = this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent = cmStrCat(*v, ';', *d);
this->SetOption(absoluteDestFileComponent,
@@ -1665,12 +1666,13 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
std::string suffix = "-" + groupOrComponentName;
/* check if we should use DISPLAY name */
std::string dispNameVar =
"CPACK_" + this->Name + "_USE_DISPLAY_NAME_IN_FILENAME";
cmStrCat("CPACK_", this->Name, "_USE_DISPLAY_NAME_IN_FILENAME");
if (this->IsOn(dispNameVar)) {
/* the component Group case */
if (isGroupName) {
std::string groupDispVar = "CPACK_COMPONENT_GROUP_" +
cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
std::string groupDispVar = cmStrCat(
"CPACK_COMPONENT_GROUP_",
cmSystemTools::UpperCase(groupOrComponentName), "_DISPLAY_NAME");
cmValue groupDispName = this->GetOption(groupDispVar);
if (groupDispName) {
suffix = "-" + *groupDispName;
@@ -1678,8 +1680,9 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
}
/* the [single] component case */
else {
std::string dispVar = "CPACK_COMPONENT_" +
cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME";
std::string dispVar = cmStrCat(
"CPACK_COMPONENT_", cmSystemTools::UpperCase(groupOrComponentName),
"_DISPLAY_NAME");
cmValue dispName = this->GetOption(dispVar);
if (dispName) {
suffix = "-" + *dispName;
+2 -2
View File
@@ -750,8 +750,8 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
return false;
}
codeIncludes.push_back("#include " + QuotePath(componentsScriptTemplate) +
"\n");
codeIncludes.push_back(
cmStrCat("#include ", QuotePath(componentsScriptTemplate), '\n'));
return true;
}
+2 -1
View File
@@ -13,6 +13,7 @@
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
#include "cmList.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -81,7 +82,7 @@ void cmCPackNuGetGenerator::SetupGroupComponentVariables(bool ignoreGroup)
end(compG.second.Components),
std::back_inserter(components),
[](cmCPackComponent const* comp) { return comp->Name; });
this->SetOption("CPACK_NUGET_" + compGUp + "_GROUP_COMPONENTS",
this->SetOption(cmStrCat("CPACK_NUGET_", compGUp, "_GROUP_COMPONENTS"),
cmList::to_string(components));
}
if (!groups.empty()) {
+18 -13
View File
@@ -82,10 +82,10 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel,
this->GetOption("CPACK_PACKAGE_FILE_NAME"), packageName, true) +
this->GetOutputExtension());
localToplevel += "/" + sanitizedPkgDirName;
localToplevel = cmStrCat(localToplevel, '/', sanitizedPkgDirName);
/* replace the TEMP DIRECTORY with the component one */
this->SetOption("CPACK_TEMPORARY_DIRECTORY", localToplevel);
packageFileName += "/" + outputFileName;
packageFileName = cmStrCat(packageFileName, '/', outputFileName);
/* replace proposed CPACK_OUTPUT_FILE_NAME */
this->SetOption("CPACK_OUTPUT_FILE_NAME", outputFileName);
/* replace the TEMPORARY package file name */
@@ -146,8 +146,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
std::transform(component.begin(), component.end(), component.begin(),
cmsysString_toupper);
if (this->IsOn("CPACK_RPM_" + compIt->first + "_DEBUGINFO_PACKAGE") ||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
if (this->IsOn(
cmStrCat("CPACK_RPM_", compIt->first, "_DEBUGINFO_PACKAGE")) ||
this->IsOn(
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
shouldSet = false;
break;
}
@@ -160,8 +162,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
std::transform(component.begin(), component.end(), component.begin(),
cmsysString_toupper);
if (this->IsOn("CPACK_RPM_" + compGIt->first + "_DEBUGINFO_PACKAGE") ||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
if (this->IsOn(
cmStrCat("CPACK_RPM_", compGIt->first, "_DEBUGINFO_PACKAGE")) ||
this->IsOn(
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
shouldSet = false;
break;
}
@@ -177,9 +181,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup)
std::transform(component.begin(), component.end(),
component.begin(), cmsysString_toupper);
if (this->IsOn("CPACK_RPM_" + compIt->first +
"_DEBUGINFO_PACKAGE") ||
this->IsOn("CPACK_RPM_" + component + "_DEBUGINFO_PACKAGE")) {
if (this->IsOn(cmStrCat("CPACK_RPM_", compIt->first,
"_DEBUGINFO_PACKAGE")) ||
this->IsOn(
cmStrCat("CPACK_RPM_", component, "_DEBUGINFO_PACKAGE"))) {
shouldSet = false;
break;
}
@@ -389,11 +394,11 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne(
std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")) +
this->GetOutputExtension());
// all GROUP in one vs all COMPONENT in one
localToplevel += "/" + compInstDirName;
localToplevel = cmStrCat(localToplevel, '/', compInstDirName);
/* replace the TEMP DIRECTORY with the component one */
this->SetOption("CPACK_TEMPORARY_DIRECTORY", localToplevel);
packageFileName += "/" + outputFileName;
packageFileName = cmStrCat(packageFileName, '/', outputFileName);
/* replace proposed CPACK_OUTPUT_FILE_NAME */
this->SetOption("CPACK_OUTPUT_FILE_NAME", outputFileName);
/* replace the TEMPORARY package file name */
@@ -457,8 +462,8 @@ std::string cmCPackRPMGenerator::GetComponentInstallSuffix(
}
// We have to find the name of the COMPONENT GROUP
// the current COMPONENT belongs to.
std::string groupVar =
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
std::string groupVar = cmStrCat(
"CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP");
if (cmValue v = this->GetOption(groupVar)) {
return *v;
}
+3 -2
View File
@@ -15,6 +15,7 @@
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmValue.h"
@@ -77,7 +78,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
cmsys::ifstream ilfs(inLicFile.c_str());
std::string licenseText;
while (cmSystemTools::GetLineFromStream(ilfs, line)) {
licenseText += line + "\n";
licenseText = cmStrCat(licenseText, line, '\n');
}
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText);
@@ -88,7 +89,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
cmsys::ifstream ifs(inFile.c_str());
std::string packageHeaderText;
while (cmSystemTools::GetLineFromStream(ifs, line)) {
packageHeaderText += line + "\n";
packageHeaderText = cmStrCat(packageHeaderText, line, '\n');
}
// Configure in the values
+2 -1
View File
@@ -17,6 +17,7 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
@@ -399,7 +400,7 @@ bool cmCTestBZR::LoadRevisions()
std::string revs;
if (atoi(this->OldRevision.c_str()) <= atoi(this->NewRevision.c_str())) {
// DoRevision takes care of discarding the information about OldRevision
revs = this->OldRevision + ".." + this->NewRevision;
revs = cmStrCat(this->OldRevision, "..", this->NewRevision);
} else {
return true;
}
+2 -1
View File
@@ -1099,7 +1099,8 @@ void cmCTestBuildHandler::ProcessBuffer(char const* data, size_t length,
// Copy pre-context to report
for (std::string const& pc : this->PreContext) {
errorwarning.PreContext += pc + "\n";
errorwarning.PreContext =
cmStrCat(errorwarning.PreContext, pc, '\n');
}
this->PreContext.clear();
+2 -2
View File
@@ -87,7 +87,7 @@ bool cmCTestCVS::UpdateImpl()
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
args.push_back("-D" + this->GetNightlyTime() + " UTC");
args.push_back(cmStrCat("-D", this->GetNightlyTime(), " UTC"));
}
// Run "cvs update" to update the work tree.
@@ -241,7 +241,7 @@ void cmCTestCVS::WriteXMLDirectory(cmXMLWriter& xml, std::string const& path,
// Load revisions and write an entry for each file in this directory.
std::vector<Revision> revisions;
for (auto const& fi : dir) {
std::string full = path + slash + fi.first;
std::string full = cmStrCat(path, slash, fi.first);
// Load two real or unknown revisions.
revisions.clear();
+5 -5
View File
@@ -164,7 +164,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(std::string const& file,
} else {
checkDir = fSrcDir;
}
fFile = checkDir + "/" + relPath;
fFile = cmStrCat(checkDir, '/', relPath);
fFile = cmSystemTools::GetFilenamePath(fFile);
if (fileDir == fFile) {
@@ -492,7 +492,7 @@ int cmCTestCoverageHandler::ProcessHandler()
// Handle all the files in the extra coverage globs that have no cov data
for (std::string const& u : uncovered) {
std::string fileName = cmSystemTools::GetFilenameName(u);
std::string fullPath = cont.SourceDir + "/" + u;
std::string fullPath = cmStrCat(cont.SourceDir, '/', u);
covLogXML.StartElement("File");
covLogXML.Attribute("Name", fileName);
@@ -1866,11 +1866,11 @@ std::string cmCTestCoverageHandler::FindFile(
std::string fileNameNoE =
cmSystemTools::GetFilenameWithoutLastExtension(fileName);
// First check in source and binary directory
std::string fullName = cont->SourceDir + "/" + fileNameNoE + ".py";
std::string fullName = cmStrCat(cont->SourceDir, '/', fileNameNoE, ".py");
if (cmSystemTools::FileExists(fullName)) {
return fullName;
}
fullName = cont->BinaryDir + "/" + fileNameNoE + ".py";
fullName = cmStrCat(cont->BinaryDir, '/', fileNameNoE, ".py");
if (cmSystemTools::FileExists(fullName)) {
return fullName;
}
@@ -2436,7 +2436,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
std::string glob = cont->SourceDir + "/" + ecg;
std::string glob = cmStrCat(cont->SourceDir, '/', ecg);
gl.FindFiles(glob);
std::vector<std::string> files = gl.GetFiles();
for (std::string const& f : files) {
+2 -2
View File
@@ -103,8 +103,8 @@ bool cmCTestDiscoverTests(cmTestDiscoveryArgs const& args,
cmsys::RegularExpression re;
if (!re.compile(AddAnchors(args.DiscoveryMatch))) {
std::string e = "DISCOVERY_MATCH failed to compile regex \"" +
args.DiscoveryMatch + "\".";
std::string e = cmStrCat("DISCOVERY_MATCH failed to compile regex \"",
args.DiscoveryMatch, "\".");
status.SetError(e);
return false;
}
+2 -2
View File
@@ -110,7 +110,7 @@ std::string cmCTestGIT::FindGitDir()
// Git reports a relative path only when the .git directory is in
// the current directory.
if (git_dir[0] == '.') {
git_dir = this->SourceDirectory + "/" + git_dir;
git_dir = cmStrCat(this->SourceDirectory, '/', git_dir);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
else if (git_dir[0] == '/') {
@@ -602,7 +602,7 @@ char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = { '\n', '\n',
bool cmCTestGIT::LoadRevisions()
{
// Use 'git rev-list ... | git diff-tree ...' to get revisions.
std::string range = this->OldRevision + ".." + this->NewRevision;
std::string range = cmStrCat(this->OldRevision, "..", this->NewRevision);
std::string git = this->CommandLineTool;
std::vector<std::string> git_rev_list = { git, "rev-list", "--reverse",
range, "--" };
+2 -1
View File
@@ -6,6 +6,7 @@
#include <utility>
#include "cmCTest.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
@@ -82,7 +83,7 @@ void cmCTestGlobalVC::WriteXMLDirectory(cmXMLWriter& xml,
xml.StartElement("Directory");
xml.Element("Name", path);
for (auto const& f : dir) {
std::string const full = path + slash + f.first;
std::string const full = cmStrCat(path, slash, f.first);
this->WriteXMLEntry(xml, path, f.first, full, f.second);
}
xml.EndElement(); // Directory
+2 -1
View File
@@ -12,6 +12,7 @@
#include "cmCTest.h"
#include "cmCTestVC.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmXMLParser.h"
@@ -272,7 +273,7 @@ bool cmCTestHG::LoadRevisions()
// The "list of strings" templates like {files} will not work when
// the project has spaces in the path. Also, they may not have
// proper XML escapes.
std::string range = this->OldRevision + ":" + this->NewRevision;
std::string range = cmStrCat(this->OldRevision, ':', this->NewRevision);
std::string hg = this->CommandLineTool;
std::string hgXMLTemplate = "<logentry\n"
" revision=\"{node|short}\">\n"
+2 -2
View File
@@ -249,7 +249,7 @@ bool cmCTestSVN::UpdateImpl()
// Specify the start time for nightly testing.
if (this->CTest->GetTestModel() == cmCTest::NIGHTLY) {
args.push_back("-r{" + this->GetNightlyTime() + " +0000}");
args.push_back(cmStrCat("-r{", this->GetNightlyTime(), " +0000}"));
}
std::vector<std::string> svn_update;
@@ -383,7 +383,7 @@ bool cmCTestSVN::LoadRevisions(SVNInfo& svninfo)
// We are interested in every revision included in the update.
std::string revs;
if (atoi(svninfo.OldRevision.c_str()) < atoi(svninfo.NewRevision.c_str())) {
revs = "-r" + svninfo.OldRevision + ":" + svninfo.NewRevision;
revs = cmStrCat("-r", svninfo.OldRevision, ':', svninfo.NewRevision);
} else {
revs = "-r" + svninfo.NewRevision;
}
+14 -13
View File
@@ -280,7 +280,8 @@ bool cmCTestDiscoverTestsCommand::InitialPass(
}
if (!unparsed.empty()) {
status.SetError(" given unknown argument \"" + unparsed.front() + "\".");
status.SetError(
cmStrCat(" given unknown argument \"", unparsed.front(), "\"."));
return false;
}
@@ -1083,7 +1084,7 @@ void cmCTestTestHandler::ComputeOutOfDateTests()
continue;
}
std::string const stampFile = stampDir + "/" + tp.GetStampFile();
std::string const stampFile = cmStrCat(stampDir, '/', tp.GetStampFile());
if (!cmSystemTools::FileExists(stampFile)) {
finalList.push_back(tp);
@@ -1129,17 +1130,17 @@ void cmCTestTestHandler::UpdateForFixtures(ListOfTests& tests) const
setupRegExp = this->TestOptions.ExcludeFixtureSetupRegularExpression;
} else {
setupRegExp.append(
"(" + setupRegExp + ")|(" +
this->TestOptions.ExcludeFixtureSetupRegularExpression + ")");
cmStrCat('(', setupRegExp, ")|(",
this->TestOptions.ExcludeFixtureSetupRegularExpression, ')'));
}
}
if (!this->TestOptions.ExcludeFixtureCleanupRegularExpression.empty()) {
if (cleanupRegExp.empty()) {
cleanupRegExp = this->TestOptions.ExcludeFixtureCleanupRegularExpression;
} else {
cleanupRegExp.append(
"(" + cleanupRegExp + ")|(" +
this->TestOptions.ExcludeFixtureCleanupRegularExpression + ")");
cleanupRegExp.append(cmStrCat(
'(', cleanupRegExp, ")|(",
this->TestOptions.ExcludeFixtureCleanupRegularExpression, ')'));
}
}
cmsys::RegularExpression excludeSetupRegex(setupRegExp);
@@ -1574,7 +1575,7 @@ void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml)
xml.Element("StartTestTime", this->StartTestTime);
xml.StartElement("TestList");
for (cmCTestTestResult const& result : this->TestResults) {
std::string testPath = result.Path + "/" + result.Name;
std::string testPath = cmStrCat(result.Path, '/', result.Name);
xml.Element("Test", this->CTest->GetShortPathToFile(testPath));
}
xml.EndElement(); // TestList
@@ -1696,7 +1697,7 @@ void cmCTestTestHandler::WriteTestResultHeader(cmXMLWriter& xml,
} else {
xml.Attribute("Status", "failed");
}
std::string testPath = result.Path + "/" + result.Name;
std::string testPath = cmStrCat(result.Path, '/', result.Name);
xml.Element("Name", result.Name);
xml.Element("Path", this->CTest->GetShortPathToFile(result.Path));
xml.Element("FullName", this->CTest->GetShortPathToFile(testPath));
@@ -2128,7 +2129,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
}
std::string lastTestsFailedLog =
this->CTest->GetBinaryDir() + "/Testing/Temporary/" + logName;
cmStrCat(this->CTest->GetBinaryDir(), "/Testing/Temporary/", logName);
if (!cmSystemTools::FileExists(lastTestsFailedLog)) {
if (!this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels()) {
@@ -2210,7 +2211,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
xml.StartElement("NamedMeasurement");
xml.Attribute("name", parser.MeasurementName);
xml.Attribute("text", "text/string");
xml.Element("Value", "File " + filename + " not found");
xml.Element("Value", cmStrCat("File ", filename, " not found"));
xml.EndElement();
cmCTestOptionalLog(
this->CTest, HANDLER_OUTPUT,
@@ -2222,7 +2223,7 @@ void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
xml.Attribute("name", parser.MeasurementName);
xml.Attribute("type", "text/string");
xml.Attribute("encoding", "none");
xml.Element("Value", "Image " + filename + " is empty");
xml.Element("Value", cmStrCat("Image ", filename, " is empty"));
xml.EndElement();
} else {
if (parser.MeasurementType == "file") {
@@ -2328,7 +2329,7 @@ void cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length,
} else if (truncate == cmCTestTypes::TruncationMode::Middle) {
char const* current = utf8_advance(begin, end, length / 2);
output.erase(current - begin, output.size() - length);
output.insert(current - begin, "..." + msg + "...");
output.insert(current - begin, cmStrCat("...", msg, "..."));
} else { // default or "tail"
char const* current = utf8_advance(begin, end, length);
output.erase(current - begin);
+2 -2
View File
@@ -260,8 +260,8 @@ bool cmCTestUpdateCommand::ExecuteUpdate(UpdateArguments& args,
xml.Element("Site", mf.GetSafeDefinition("CTEST_SITE"));
xml.Element("BuildName", buildname);
xml.Element("BuildStamp",
this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestGroupString());
cmStrCat(this->CTest->GetCurrentTag(), '-',
this->CTest->GetTestGroupString()));
xml.Element("StartDateTime", start_time);
xml.Element("StartTime", start_time_time);
xml.Element("UpdateCommand", vc->GetUpdateCommandLine());
+3 -2
View File
@@ -16,6 +16,7 @@
#include "cmGeneratedFileStream.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmVersion.h"
#include "cmXMLWriter.h"
@@ -59,8 +60,8 @@ bool cmCTestUploadCommand::ExecuteUpload(UploadArguments& args,
xml.StartElement("Site");
xml.Attribute("BuildName", buildname);
xml.Attribute("BuildStamp",
this->CTest->GetCurrentTag() + "-" +
this->CTest->GetTestGroupString());
cmStrCat(this->CTest->GetCurrentTag(), '-',
this->CTest->GetTestGroupString()));
xml.Attribute("Name", mf.GetSafeDefinition("CTEST_SITE"));
xml.Attribute("Generator",
std::string("ctest-") + cmVersion::GetCMakeVersion());
+2 -1
View File
@@ -8,6 +8,7 @@
#include "cmCTest.h"
#include "cmCTestCoverageHandler.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmParseDelphiCoverage::HTMLParser
@@ -133,7 +134,7 @@ public:
cmsys::Glob gl;
gl.RecurseOn();
gl.RecurseThroughSymlinksOff();
std::string glob = this->Coverage.SourceDir + "*/" + filename;
std::string glob = cmStrCat(this->Coverage.SourceDir, "*/", filename);
gl.FindFiles(glob);
std::vector<std::string> const& files = gl.GetFiles();
if (files.empty()) {
+1 -1
View File
@@ -48,7 +48,7 @@ protected:
"Reading file: " << fileName << std::endl,
this->Coverage.Quiet);
this->FilePath = this->PackagePath + "/" + fileName;
this->FilePath = cmStrCat(this->PackagePath, '/', fileName);
cmsys::ifstream fin(this->FilePath.c_str());
if (!fin) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
+3 -2
View File
@@ -456,10 +456,11 @@ void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog)
int percentCompleted = static_cast<int>(100 * prog);
this->LastProgress = (percentCompleted < 100 ? " " : "");
this->LastProgress += (percentCompleted < 10 ? " " : "");
this->LastProgress += std::to_string(percentCompleted) + "% [";
this->LastProgress =
cmStrCat(this->LastProgress, std::to_string(percentCompleted), "% [");
this->LastProgress.append(progressBarCompleted, '#');
this->LastProgress.append(progressBarWidth - progressBarCompleted, ' ');
this->LastProgress += "] " + msg + "...";
this->LastProgress = cmStrCat(this->LastProgress, "] ", msg, "...");
this->DisplayOutputs(std::string());
} else {
this->Outputs.emplace_back(msg);
@@ -500,7 +500,7 @@ cm::optional<std::string> GetDistribValue(
std::string vars;
for (auto const& kv : *os_release) {
auto cmake_var_name = cmStrCat(variable, '_', kv.first);
vars += DELIM[!vars.empty()] + cmake_var_name;
vars = cmStrCat(vars, DELIM[!vars.empty()], cmake_var_name);
makefile.AddDefinition(cmake_var_name, kv.second);
}
return cm::optional<std::string>(std::move(vars));
+1 -1
View File
@@ -184,7 +184,7 @@ std::vector<std::string> GetPkgConfSysCflags(cmMakefile& mf)
std::string tmp;
cmSystemTools::GetEnv(var, tmp);
if (!tmp.empty()) {
paths += ";" + tmp;
paths = cmStrCat(paths, ';', tmp);
}
}
};
+1 -1
View File
@@ -707,7 +707,7 @@ bool cmCTest::OpenOutputFile(std::string const& path, std::string const& name,
{
std::string testingDir = this->Impl->BinaryDir + "/Testing";
if (!path.empty()) {
testingDir += "/" + path;
testingDir = cmStrCat(testingDir, '/', path);
}
if (cmSystemTools::FileExists(testingDir)) {
if (!cmSystemTools::FileIsDirectory(testingDir)) {
+2 -2
View File
@@ -1082,8 +1082,8 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
if (testLangs.find(LinkerLanguage) == testLangs.end()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
"Linker language '" + LinkerLanguage +
"' must be enabled in project(LANGUAGES).");
cmStrCat("Linker language '", LinkerLanguage,
"' must be enabled in project(LANGUAGES)."));
}
fprintf(fout, "set_property(TARGET %s PROPERTY LINKER_LANGUAGE %s)\n",
+1 -1
View File
@@ -37,7 +37,7 @@ static void cmFortranModuleAppendUpperLower(std::string const& mod,
}
std::string const& name = mod.substr(0, mod.size() - ext_len);
std::string const& ext = mod.substr(mod.size() - ext_len);
mod_upper += cmSystemTools::UpperCase(name) + ext;
mod_upper = cmStrCat(mod_upper, cmSystemTools::UpperCase(name), ext);
mod_lower += mod;
}
+3 -1
View File
@@ -20,6 +20,7 @@
#include "cmMakefile.h"
#include "cmPolicies.h"
#include "cmScriptGenerator.h"
#include "cmStringAlgorithms.h"
#include "cmTestDiscovery.h"
#include "cmTestGenerator.h"
@@ -119,7 +120,8 @@ bool cmDiscoverTestsCommand(std::vector<std::string> const& args,
}
if (!unparsed.empty()) {
status.SetError(" given unknown argument \"" + unparsed.front() + "\".");
status.SetError(
cmStrCat(" given unknown argument \"", unparsed.front(), "\"."));
return false;
}
+2 -2
View File
@@ -64,7 +64,7 @@ std::vector<std::string> cmEnvironment::GetVariables() const
result.reserve(this->Map.size());
for (auto const& elem : this->Map) {
if (elem.second) {
result.push_back(elem.first + '=' + *elem.second);
result.push_back(cmStrCat(elem.first, '=', *elem.second));
}
}
return result;
@@ -208,7 +208,7 @@ void cmEnvironmentModification::ApplyTo(cmEnvironment& env)
for (auto const& e : this->Entries) {
if (e.Op == "set") {
env.PutEnv(e.Name + "=" + e.Value);
env.PutEnv(cmStrCat(e.Name, '=', e.Value));
} else if (e.Op == "unset") {
env.UnPutEnv(e.Name);
} else if (e.Op == "string_append") {
+4 -4
View File
@@ -135,8 +135,8 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
return true;
}
if (!unparsedArguments.empty()) {
status.SetError(" given unknown argument \"" + unparsedArguments.front() +
"\".");
status.SetError(cmStrCat(" given unknown argument \"",
unparsedArguments.front(), "\"."));
return false;
}
@@ -159,8 +159,8 @@ bool cmExecuteProcessCommand(std::vector<std::string> const& args,
}
if (!status.GetMakefile().CanIWriteThisFile(outputFilename)) {
status.SetError("attempted to output into a file: " + outputFilename +
" into a source directory.");
status.SetError(cmStrCat("attempted to output into a file: ",
outputFilename, " into a source directory."));
cmSystemTools::SetFatalErrorOccurred();
return false;
}
+2 -1
View File
@@ -41,7 +41,8 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
std::string sep;
bool generatedInterfaceRequired = false;
auto visitor = [&](cmGeneratorTarget const* te) {
expectedTargets += sep + this->Namespace + te->GetExportName();
expectedTargets =
cmStrCat(expectedTargets, sep, this->Namespace, te->GetExportName());
sep = " ";
generatedInterfaceRequired |=
+2 -2
View File
@@ -507,8 +507,8 @@ static bool HandleSetupMode(std::vector<std::string> const& args,
SetupArguments arguments = parser.Parse(args, &unknownArgs);
if (!unknownArgs.empty()) {
status.SetError("SETUP given unknown argument: \"" + unknownArgs.front() +
"\".");
status.SetError(cmStrCat("SETUP given unknown argument: \"",
unknownArgs.front(), "\"."));
return false;
}
+1 -1
View File
@@ -462,7 +462,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
} else {
this->ResolveTargetsInGeneratorExpression(li, target, lg);
}
input += sep + li;
input = cmStrCat(input, sep, li);
sep = ";";
}
}
@@ -49,7 +49,8 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
std::string sep;
auto visitor = [&](cmTargetExport const* te) {
allTargets.push_back(te);
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
expectedTargets = cmStrCat(expectedTargets, sep, this->Namespace,
te->Target->GetExportName());
sep = " ";
};
+1 -1
View File
@@ -605,7 +605,7 @@ void cmExportInstallFileGenerator::PopulateIncludeDirectoriesInterface(
std::string includes = (input ? *input : "");
char const* const sep = input ? ";" : "";
includes += sep + exportDirs;
includes = cmStrCat(includes, sep, exportDirs);
std::string prepro = cmGeneratorExpression::Preprocess(
includes, preprocessRule, this->GetImportPrefixWithSlash());
if (!prepro.empty()) {
+7 -6
View File
@@ -573,8 +573,8 @@ void cmFastbuildNormalTargetGenerator::ComputePCH(
// Reuse compiler options for PCH options.
node.PCHOptions += origCompileOptions;
if (this->Makefile->GetSafeDefinition("CMAKE_" + language +
"_COMPILER_ID") == "MSVC") {
if (this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", language, "_COMPILER_ID")) == "MSVC") {
cmSystemTools::ReplaceString(node.PCHOptions,
FASTBUILD_2_INPUT_PLACEHOLDER,
FASTBUILD_3_INPUT_PLACEHOLDER);
@@ -1796,8 +1796,9 @@ void cmFastbuildNormalTargetGenerator::AppendExternalObject(
else if (target) {
if (!linkedDeps.emplace(objLibName + FASTBUILD_OBJECTS_ALIAS_POSTFIX)
.second) {
LogMessage("Object Target: " + objLibName +
FASTBUILD_OBJECTS_ALIAS_POSTFIX " already linked");
LogMessage(cmStrCat("Object Target: ", objLibName,
FASTBUILD_OBJECTS_ALIAS_POSTFIX
" already linked"));
continue;
}
linkerNode.LibrarianAdditionalInputs.emplace_back(
@@ -1885,8 +1886,8 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
// Skip exported objects.
// Tested in "ExportImport" test.
if (depType == cm::TargetType::OBJECT_LIBRARY) {
LogMessage("target : " + item.Target->GetName() +
" already linked... Skipping");
LogMessage(cmStrCat("target : ", item.Target->GetName(),
" already linked... Skipping"));
return;
}
// Tested in "ExportImport" test.
+4 -3
View File
@@ -157,7 +157,8 @@ std::string cmFastbuildTargetGenerator::GetCustomCommandTargetName(
extras += std::to_string(static_cast<int>(step));
cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
targetName += "-" + hash.HashString(extras).substr(0, 14);
targetName =
cmStrCat(targetName, '-', hash.HashString(extras).substr(0, 14));
return targetName;
}
@@ -674,8 +675,8 @@ FastbuildExecNodes cmFastbuildTargetGenerator::GenerateCommands(
execNode.PreBuildDependencies);
for (auto const& util : ccg.GetUtilities()) {
auto const& utilTargetName = util.Value.first;
LogMessage("Util: " + utilTargetName +
", cross: " + std::to_string(util.Value.second));
LogMessage(cmStrCat("Util: ", utilTargetName,
", cross: ", std::to_string(util.Value.second)));
auto* const target = this->Makefile->FindTargetToUse(utilTargetName);
if (target && target->IsImported()) {
+4 -4
View File
@@ -75,8 +75,8 @@ void cmFastbuildUtilityTargetGenerator::Generate()
if (target && target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
for (auto const& dep : target->GetUtilities()) {
auto const& depName = this->ConvertToFastbuildPath(dep.Value.first);
LogMessage("Transitively propagating iface dep: " + depName +
", is cross: " + std::to_string(dep.Value.second));
LogMessage(cmStrCat("Transitively propagating iface dep: ", depName,
", is cross: ", std::to_string(dep.Value.second)));
nonImportedUtils.emplace_back(depName);
addUtilDepToTarget(this->ConvertToFastbuildPath(depName));
}
@@ -117,8 +117,8 @@ void cmFastbuildUtilityTargetGenerator::Generate()
for (auto& exec : GenerateCommands(FastbuildBuildStep::REST).Nodes) {
addUtilDepToTarget(exec.Name);
for (auto const& dep : TargetDirectDependencies) {
LogMessage("Direct dep " + dep->GetName() +
"-all propagating to CC: " + exec.Name);
LogMessage(cmStrCat("Direct dep ", dep->GetName(),
"-all propagating to CC: ", exec.Name));
// All custom commands from within the target must be executed AFTER all
// the target's deps.
exec.PreBuildDependencies.emplace(dep->GetName());
+3 -3
View File
@@ -316,7 +316,7 @@ std::string TargetId(cmGeneratorTarget const* gt, std::string const& topBuild)
topBuild, gt->GetLocalGenerator()->GetCurrentBinaryDirectory());
std::string hash = hasher.HashString(path);
hash.resize(20, '0');
return gt->GetName() + CMAKE_DIRECTORY_ID_SEP + hash;
return cmStrCat(gt->GetName(), CMAKE_DIRECTORY_ID_SEP, hash);
}
struct CompileData
@@ -755,7 +755,7 @@ Json::Value CodemodelConfig::DumpTarget(cmGeneratorTarget* gt,
std::replace(safeTargetName.begin(), safeTargetName.end(), ':', '_');
std::string prefix = "target-" + safeTargetName;
if (!this->Config.empty()) {
prefix += "-" + this->Config;
prefix = cmStrCat(prefix, '-', this->Config);
}
Json::Value target = this->FileAPI.MaybeJsonFile(t.Dump(), prefix);
target["name"] = gt->GetName();
@@ -856,7 +856,7 @@ Json::Value CodemodelConfig::DumpDirectoryObject(Directory& d)
}
}
if (!this->Config.empty()) {
prefix += "-" + this->Config;
prefix = cmStrCat(prefix, '-', this->Config);
}
DirectoryObject dir(d.LocalGenerator, this->VersionMajor, this->VersionMinor,
+11 -11
View File
@@ -755,7 +755,7 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
expr = status.GetMakefile().GetCurrentSourceDirectory();
// Handle script mode
if (!expr.empty()) {
expr += "/" + *i;
expr = cmStrCat(expr, '/', *i);
} else {
expr = *i;
}
@@ -2126,10 +2126,10 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
std::string dir = cmSystemTools::GetFilenamePath(file);
if (!dir.empty() && !cmSystemTools::FileExists(dir) &&
!cmSystemTools::MakeDirectory(dir)) {
std::string errstring = "DOWNLOAD error: cannot create directory '" +
dir +
"' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.";
std::string errstring =
cmStrCat("DOWNLOAD error: cannot create directory '", dir,
"' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.");
status.SetError(errstring);
return false;
}
@@ -2358,10 +2358,10 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
if (expectedHash != actualHash) {
if (!statusVar.empty() && res == 0) {
status.GetMakefile().AddDefinition(statusVar,
"1;HASH mismatch: "
"expected: " +
expectedHash +
" actual: " + actualHash);
cmStrCat("1;HASH mismatch: "
"expected: ",
expectedHash,
" actual: ", actualHash));
}
status.SetError(cmStrCat("DOWNLOAD HASH mismatch\n"
@@ -3644,8 +3644,8 @@ bool HandleConfigureCommand(std::vector<std::string> const& args,
cmMakefile& makeFile = status.GetMakefile();
if (!makeFile.CanIWriteThisFile(outputFile)) {
cmSystemTools::Error("Attempt to write file: " + outputFile +
" into a source directory.");
cmSystemTools::Error(cmStrCat("Attempt to write file: ", outputFile,
" into a source directory."));
return false;
}
+3 -2
View File
@@ -447,8 +447,9 @@ bool cmFileInstaller::HandleInstallDestination()
if (this->InstallType != cmInstallType_DIRECTORY) {
if (!cmSystemTools::FileExists(destination)) {
if (!cmSystemTools::MakeDirectory(destination, default_dir_mode)) {
std::string errstring = "cannot create directory: " + destination +
". Maybe need administrative privileges.";
std::string errstring =
cmStrCat("cannot create directory: ", destination,
". Maybe need administrative privileges.");
this->Status.SetError(errstring);
return false;
}
+1 -1
View File
@@ -82,7 +82,7 @@ std::string cmFortranParser_s::SModName(std::string const& mod_name,
if (this->Compiler.SModSep.empty()) {
return sub_name + SModExt;
}
return mod_name + this->Compiler.SModSep + sub_name + SModExt;
return cmStrCat(mod_name, this->Compiler.SModSep, sub_name, SModExt);
}
bool cmFortranParser_FilePush(cmFortranParser* parser, char const* fname)
@@ -167,7 +167,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
std::string line;
std::string sep;
while (cmSystemTools::GetLineFromStream(fin, line)) {
inputContent += sep + line;
inputContent = cmStrCat(inputContent, sep, line);
sep = "\n";
}
inputContent += sep;
+2 -1
View File
@@ -4834,7 +4834,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string linkedTargetsContent = getLinkedTargetsContent(
target, interfacePropertyName, eval, &dagChecker, usage);
if (!linkedTargetsContent.empty()) {
result += (result.empty() ? "" : ";") + linkedTargetsContent;
result =
cmStrCat(result, (result.empty() ? "" : ";"), linkedTargetsContent);
}
}
return result;
+14 -14
View File
@@ -1326,7 +1326,7 @@ std::string cmGeneratorTarget::GetCompilePDBName(
*config_name, this->LocalGenerator, config, this);
NameComponents const& components = GetFullNameInternalComponents(
config, cmStateEnums::RuntimeBinaryArtifact);
return components.prefix + pdbName + ".pdb";
return cmStrCat(components.prefix, pdbName, ".pdb");
}
cmValue name = this->GetProperty("COMPILE_PDB_NAME");
@@ -1335,7 +1335,7 @@ std::string cmGeneratorTarget::GetCompilePDBName(
*name, this->LocalGenerator, config, this);
NameComponents const& components = GetFullNameInternalComponents(
config, cmStateEnums::RuntimeBinaryArtifact);
return components.prefix + pdbName + ".pdb";
return cmStrCat(components.prefix, pdbName, ".pdb");
}
// If the target is PCH-reused or PCH-reuses, we need a stable name for the
@@ -3211,8 +3211,8 @@ std::string cmGeneratorTarget::GetPchHeader(std::string const& config,
generatorTarget = reuseTarget;
}
auto const inserted =
this->PchHeaders.insert(std::make_pair(language + config + arch, ""));
auto const inserted = this->PchHeaders.insert(
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::vector<BT<std::string>> const headers =
this->GetPrecompileHeaders(config, language);
@@ -3305,8 +3305,8 @@ std::string cmGeneratorTarget::GetPchSource(std::string const& config,
language != "OBJCXX") {
return std::string();
}
auto const inserted =
this->PchSources.insert(std::make_pair(language + config + arch, ""));
auto const inserted = this->PchSources.insert(
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::string const pchHeader = this->GetPchHeader(config, language, arch);
if (pchHeader.empty()) {
@@ -3365,8 +3365,8 @@ std::string cmGeneratorTarget::GetPchFileObject(std::string const& config,
language != "OBJCXX") {
return std::string();
}
auto const inserted =
this->PchObjectFiles.insert(std::make_pair(language + config + arch, ""));
auto const inserted = this->PchObjectFiles.insert(
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::string const pchSource = this->GetPchSource(config, language, arch);
if (pchSource.empty()) {
@@ -3388,8 +3388,8 @@ std::string cmGeneratorTarget::GetPchFile(std::string const& config,
std::string const& language,
std::string const& arch)
{
auto const inserted =
this->PchFiles.insert(std::make_pair(language + config + arch, ""));
auto const inserted = this->PchFiles.insert(
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::string& pchFile = inserted.first->second;
@@ -3448,7 +3448,7 @@ std::string cmGeneratorTarget::GetPchCreateCompileOptions(
std::string const& arch)
{
auto const inserted = this->PchCreateCompileOptions.insert(
std::make_pair(language + config + arch, ""));
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::string& createOptionList = inserted.first->second;
@@ -3496,7 +3496,7 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions(
std::string const& arch)
{
auto const inserted = this->PchUseCompileOptions.insert(
std::make_pair(language + config + arch, ""));
std::make_pair(cmStrCat(language, config, arch), ""));
if (inserted.second) {
std::string& useOptionList = inserted.first->second;
@@ -3944,7 +3944,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
targetNames.Output = components.prefix + targetNames.Base;
} else {
targetNames.Output =
components.prefix + targetNames.Base + components.suffix;
cmStrCat(components.prefix, targetNames.Base, components.suffix);
}
// The executable's real name on disk.
@@ -3977,7 +3977,7 @@ std::string cmGeneratorTarget::GetFullNameInternal(
{
NameComponents const& components =
this->GetFullNameInternalComponents(config, artifact);
return components.prefix + components.base + components.suffix;
return cmStrCat(components.prefix, components.base, components.suffix);
}
std::string cmGeneratorTarget::ImportedGetLocation(
+3 -3
View File
@@ -567,7 +567,7 @@ std::string cmGraphVizWriter::ItemNameWithAliases(
auto nameWithAliases = itemName;
for(auto const& item : items) {
nameWithAliases += "\\n(" + item + ")";
nameWithAliases = cmStrCat(nameWithAliases, "\\n(" , item , ')');
}
return nameWithAliases;
@@ -578,10 +578,10 @@ std::string cmGraphVizWriter::GetEdgeStyle(DependencyType dt)
std::string style;
switch (dt) {
case DependencyType::LinkPrivate:
style = "[ style = " + std::string(GRAPHVIZ_EDGE_STYLE_PRIVATE) + " ]";
style = cmStrCat("[ style = ", GRAPHVIZ_EDGE_STYLE_PRIVATE, " ]");
break;
case DependencyType::LinkInterface:
style = "[ style = " + std::string(GRAPHVIZ_EDGE_STYLE_INTERFACE) + " ]";
style = cmStrCat("[ style = ", GRAPHVIZ_EDGE_STYLE_INTERFACE, " ]");
break;
default:
break;
+3 -2
View File
@@ -82,8 +82,9 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
// replace any variables
std::string const& temps = *s;
if (!cmSystemTools::GetFilenamePath(temps).empty()) {
testf = cmSystemTools::GetFilenamePath(temps) + "/" +
cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
testf =
cmStrCat(cmSystemTools::GetFilenamePath(temps), '/',
cmSystemTools::GetFilenameWithoutLastExtension(temps), ext);
} else {
testf = cmSystemTools::GetFilenameWithoutLastExtension(temps) + ext;
}
+2 -2
View File
@@ -146,8 +146,8 @@ bool cmInstrumentationCommand(std::vector<std::string> const& args,
return true;
}
if (!unparsedArguments.empty()) {
status.SetError("given unknown argument \"" + unparsedArguments.front() +
"\".");
status.SetError(
cmStrCat("given unknown argument \"", unparsedArguments.front(), "\"."));
return false;
}
int apiVersion;
+43 -37
View File
@@ -182,21 +182,23 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile)
if (lang == "NONE") {
continue;
}
this->Compilers["CMAKE_" + lang + "_COMPILER"] = lang;
this->Compilers[cmStrCat("CMAKE_", lang, "_COMPILER")] = lang;
this->VariableMappings["CMAKE_" + lang + "_COMPILER"] =
this->Makefile->GetSafeDefinition("CMAKE_" + lang + "_COMPILER");
this->VariableMappings[cmStrCat("CMAKE_", lang, "_COMPILER")] =
this->Makefile->GetSafeDefinition(cmStrCat("CMAKE_", lang, "_COMPILER"));
std::string const& compilerArg1 = "CMAKE_" + lang + "_COMPILER_ARG1";
std::string const& compilerTarget = "CMAKE_" + lang + "_COMPILER_TARGET";
std::string const& compilerArg1 =
cmStrCat("CMAKE_", lang, "_COMPILER_ARG1");
std::string const& compilerTarget =
cmStrCat("CMAKE_", lang, "_COMPILER_TARGET");
std::string const& compilerOptionTarget =
"CMAKE_" + lang + "_COMPILE_OPTIONS_TARGET";
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_TARGET");
std::string const& compilerExternalToolchain =
"CMAKE_" + lang + "_COMPILER_EXTERNAL_TOOLCHAIN";
cmStrCat("CMAKE_", lang, "_COMPILER_EXTERNAL_TOOLCHAIN");
std::string const& compilerOptionExternalToolchain =
"CMAKE_" + lang + "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN";
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN");
std::string const& compilerOptionSysroot =
"CMAKE_" + lang + "_COMPILE_OPTIONS_SYSROOT";
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_SYSROOT");
this->VariableMappings[compilerArg1] =
this->Makefile->GetSafeDefinition(compilerArg1);
@@ -1204,7 +1206,7 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
// Add compile flag for the MSVC compiler only.
cmMakefile* mf = this->GetMakefile();
if (cmValue jmc =
mf->GetDefinition("CMAKE_" + lang + "_COMPILE_OPTIONS_JMC")) {
mf->GetDefinition(cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_JMC"))) {
// Handle Just My Code debugging flags, /JMC.
// If the target is a Managed C++ one, /JMC is not compatible.
@@ -1709,7 +1711,8 @@ void cmLocalGenerator::GetTargetFlags(
}
if (this->Makefile->IsOn("BUILD_SHARED_LIBS")) {
std::string sFlagVar = "CMAKE_SHARED_BUILD_" + linkLanguage + "_FLAGS";
std::string sFlagVar =
cmStrCat("CMAKE_SHARED_BUILD_", linkLanguage, "_FLAGS");
exeFlags += this->Makefile->GetSafeDefinition(sFlagVar);
exeFlags += " ";
}
@@ -2002,7 +2005,7 @@ void cmLocalGenerator::OutputLinkLibraries(
std::string libPathFlag;
if (cmValue value = this->Makefile->GetDefinition(
"CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_FLAG")) {
cmStrCat("CMAKE_", cli.GetLinkLanguage(), "_LIBRARY_PATH_FLAG"))) {
libPathFlag = *value;
} else {
libPathFlag =
@@ -2010,8 +2013,8 @@ void cmLocalGenerator::OutputLinkLibraries(
}
std::string libPathTerminator;
if (cmValue value = this->Makefile->GetDefinition(
"CMAKE_" + cli.GetLinkLanguage() + "_LIBRARY_PATH_TERMINATOR")) {
if (cmValue value = this->Makefile->GetDefinition(cmStrCat(
"CMAKE_", cli.GetLinkLanguage(), "_LIBRARY_PATH_TERMINATOR"))) {
libPathTerminator = *value;
} else {
libPathTerminator =
@@ -2099,7 +2102,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
if (sysroot && *sysroot == "/") {
sysroot = nullptr;
}
std::string sysrootFlagVar = "CMAKE_" + lang + "_SYSROOT_FLAG";
std::string sysrootFlagVar = cmStrCat("CMAKE_", lang, "_SYSROOT_FLAG");
cmValue sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
if (cmNonempty(sysrootFlag)) {
if (!this->AppleArchSysroots.empty() &&
@@ -2110,7 +2113,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
continue;
}
if (filterArch.empty() || filterArch == arch) {
flags += " -Xarch_" + arch + " ";
flags = cmStrCat(flags, " -Xarch_", arch, " ");
// Combine sysroot flag and path to work with -Xarch
std::string arch_sysroot = *sysrootFlag + archSysroot;
flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
@@ -2128,7 +2131,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
if (cmNonempty(deploymentTarget)) {
std::string deploymentTargetFlagVar =
"CMAKE_" + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
cmStrCat("CMAKE_", lang, "_OSX_DEPLOYMENT_TARGET_FLAG");
cmValue deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar);
if (cmNonempty(deploymentTargetFlag) &&
@@ -2272,16 +2275,16 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
*msvcRuntimeLibraryValue, this, config, target);
if (!msvcRuntimeLibrary.empty()) {
if (cmValue msvcRuntimeLibraryOptions = this->Makefile->GetDefinition(
"CMAKE_" + lang + "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_" +
msvcRuntimeLibrary)) {
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_",
msvcRuntimeLibrary))) {
this->AppendCompileOptions(flags, *msvcRuntimeLibraryOptions);
} else if (compilerTargetsMsvcABI &&
!cmSystemTools::GetErrorOccurredFlag()) {
// The compiler uses the MSVC ABI so it needs a known runtime library.
this->IssueMessage(MessageType::FATAL_ERROR,
"MSVC_RUNTIME_LIBRARY value '" +
msvcRuntimeLibrary + "' not known for this " +
lang + " compiler.");
this->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("MSVC_RUNTIME_LIBRARY value '", msvcRuntimeLibrary,
"' not known for this ", lang, " compiler."));
}
}
}
@@ -2299,18 +2302,19 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
std::string const watcomRuntimeLibrary = cmGeneratorExpression::Evaluate(
*watcomRuntimeLibraryValue, this, config, target);
if (!watcomRuntimeLibrary.empty()) {
if (cmValue watcomRuntimeLibraryOptions = this->Makefile->GetDefinition(
"CMAKE_" + lang + "_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_" +
watcomRuntimeLibrary)) {
if (cmValue watcomRuntimeLibraryOptions =
this->Makefile->GetDefinition(cmStrCat(
"CMAKE_", lang, "_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_",
watcomRuntimeLibrary))) {
this->AppendCompileOptions(flags, *watcomRuntimeLibraryOptions);
} else if (compilerTargetsWatcomABI &&
!cmSystemTools::GetErrorOccurredFlag()) {
// The compiler uses the Watcom ABI so it needs a known runtime
// library.
this->IssueMessage(MessageType::FATAL_ERROR,
"WATCOM_RUNTIME_LIBRARY value '" +
watcomRuntimeLibrary + "' not known for this " +
lang + " compiler.");
this->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("WATCOM_RUNTIME_LIBRARY value '", watcomRuntimeLibrary,
"' not known for this ", lang, " compiler."));
}
}
}
@@ -2526,7 +2530,8 @@ static void AddVisibilityCompileOption(std::string& flags,
cmLocalGenerator* lg,
std::string const& lang)
{
std::string compileOption = "CMAKE_" + lang + "_COMPILE_OPTIONS_VISIBILITY";
std::string compileOption =
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_VISIBILITY");
cmValue opt = lg->GetMakefile()->GetDefinition(compileOption);
if (!opt) {
return;
@@ -3482,9 +3487,9 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
filename_base, pathMode);
} else {
// unity mode is set to an unsupported value
std::string e("Invalid UNITY_BUILD_MODE value of " + *unityMode +
" assigned to target " + target->GetName() +
". Acceptable values are BATCH and GROUP.");
std::string e(cmStrCat("Invalid UNITY_BUILD_MODE value of ", *unityMode,
" assigned to target ", target->GetName(),
". Acceptable values are BATCH and GROUP."));
this->IssueMessage(MessageType::FATAL_ERROR, e);
}
@@ -3719,7 +3724,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
return;
}
std::string const name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO";
std::string const name = cmStrCat("CMAKE_", lang, "_LINK_OPTIONS_IPO");
cmValue rawFlagsList = this->Makefile->GetDefinition(name);
if (!rawFlagsList) {
return;
@@ -3752,12 +3757,13 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
std::string const mode = cmIsOn(PICValue) ? "PIE" : "NO_PIE";
std::string supported = "CMAKE_" + lang + "_LINK_" + mode + "_SUPPORTED";
std::string supported =
cmStrCat("CMAKE_", lang, "_LINK_", mode, "_SUPPORTED");
if (this->Makefile->GetDefinition(supported).IsOff()) {
return;
}
std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_" + mode;
std::string name = cmStrCat("CMAKE_", lang, "_LINK_OPTIONS_", mode);
auto pieFlags = this->Makefile->GetSafeDefinition(name);
if (pieFlags.empty()) {
+3 -3
View File
@@ -1441,11 +1441,11 @@ std::string cmLocalUnixMakefileGenerator3::CreateMakeVariable(
char buffer[12];
int ni = 0;
snprintf(buffer, sizeof(buffer), "%04d", ni);
ret = str1 + str2 + buffer;
ret = cmStrCat(str1, str2, buffer);
while (this->ShortMakeVariableMap.count(ret) && ni < 1000) {
++ni;
snprintf(buffer, sizeof(buffer), "%04d", ni);
ret = str1 + str2 + buffer;
ret = cmStrCat(str1, str2, buffer);
}
if (ni == 1000) {
cmSystemTools::Error("Borland makefile variable length too long");
@@ -2385,7 +2385,7 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
// directory and build because make resets the directory between
// each command.
std::string outputForExisting = this->ConvertToOutputForExisting(tgtDir);
std::string prefix = cd_cmd + outputForExisting + " && ";
std::string prefix = cmStrCat(cd_cmd, outputForExisting, " && ");
std::transform(commands.begin(), commands.end(), commands.begin(),
[&prefix](std::string const& s) { return prefix + s; });
}
+3 -2
View File
@@ -5,6 +5,7 @@
#include "cmDiagnostics.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
// cmMakeDirectoryCommand
@@ -22,8 +23,8 @@ bool cmMakeDirectoryCommand(std::vector<std::string> const& args,
return false;
}
if (!mf.CanIWriteThisFile(args[0])) {
std::string e = "attempted to create a directory: " + args[0] +
" into a source directory.";
std::string e = cmStrCat("attempted to create a directory: ", args[0],
" into a source directory.");
status.SetError(e);
cmSystemTools::SetFatalErrorOccurred();
return false;
+7 -7
View File
@@ -2845,10 +2845,10 @@ MessageType cmMakefile::ExpandVariablesInStringImpl(
lookup.domain = CACHE;
} else {
if (this->cmNamedCurly.find(next)) {
errorstr = "Syntax $" +
std::string(next, this->cmNamedCurly.end()) +
"{} is not supported. Only ${}, $ENV{}, "
"and $CACHE{} are allowed.";
errorstr = cmStrCat("Syntax $",
std::string(next, this->cmNamedCurly.end()),
"{} is not supported. Only ${}, $ENV{}, "
"and $CACHE{} are allowed.");
mtype = MessageType::FATAL_ERROR;
error = true;
}
@@ -3424,9 +3424,9 @@ int cmMakefile::TryCompile(std::string const& srcdir,
auto gg = cm.CreateGlobalGenerator(this->GetGlobalGenerator()->GetName());
if (!gg) {
this->IssueMessage(MessageType::INTERNAL_ERROR,
"Global generator '" +
this->GetGlobalGenerator()->GetName() +
"' could not be created.");
cmStrCat("Global generator '",
this->GetGlobalGenerator()->GetName(),
"' could not be created."));
cmSystemTools::SetFatalErrorOccurred();
this->IsSourceFileTryCompile = false;
return 1;
+10 -9
View File
@@ -99,8 +99,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
// Get the name of the device object to generate.
std::string const& objExt =
this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
std::string const targetOutput =
this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
std::string const targetOutput = cmStrCat(
this->GeneratorTarget->ObjectDirectory, "cmake_device_link", objExt);
this->DeviceLinkObject = targetOutput;
this->NumberOfProgressActions++;
@@ -347,8 +347,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Make sure we have a link language.
if (linkLanguage.empty()) {
cmSystemTools::Error("Cannot determine link language for target \"" +
this->GeneratorTarget->GetName() + "\".");
cmSystemTools::Error(
cmStrCat("Cannot determine link language for target \"",
this->GeneratorTarget->GetName(), "\"."));
return;
}
@@ -528,11 +529,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
this->CreateObjectLists(useLinkScript, false, useResponseFileForObjects,
buildObjs, depends, useWatcomQuote, linkLanguage);
if (!this->DeviceLinkObject.empty()) {
buildObjs += " " +
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(
this->DeviceLinkObject),
cmOutputConverter::SHELL);
buildObjs = cmStrCat(buildObjs, ' ',
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(
this->DeviceLinkObject),
cmOutputConverter::SHELL));
}
// maybe create .def file from list of objects
+10 -9
View File
@@ -270,8 +270,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION");
// Get the name of the device object to generate.
std::string const targetOutput =
this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt;
std::string const targetOutput = cmStrCat(
this->GeneratorTarget->ObjectDirectory, "cmake_device_link", objExt);
this->DeviceLinkObject = targetOutput;
this->NumberOfProgressActions++;
@@ -466,8 +466,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Make sure we have a link language.
if (linkLanguage.empty()) {
cmSystemTools::Error("Cannot determine link language for target \"" +
this->GeneratorTarget->GetName() + "\".");
cmSystemTools::Error(
cmStrCat("Cannot determine link language for target \"",
this->GeneratorTarget->GetName(), "\"."));
return;
}
@@ -764,11 +765,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
useResponseFileForObjects, buildObjs, depends,
useWatcomQuote, linkLanguage, responseMode);
if (!this->DeviceLinkObject.empty()) {
buildObjs += " " +
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(
this->DeviceLinkObject),
cmOutputConverter::SHELL);
buildObjs = cmStrCat(buildObjs, ' ',
this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->MaybeRelativeToCurBinDir(
this->DeviceLinkObject),
cmOutputConverter::SHELL));
}
std::string const& aixExports = this->GetAIXExports(this->GetConfigName());
+11 -11
View File
@@ -990,7 +990,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string includesString = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, lang, config);
this->LocalGenerator->AppendFlags(includesString,
"$(" + lang + "_INCLUDES)");
cmStrCat("$(", lang, "_INCLUDES)"));
vars.Includes = includesString.c_str();
std::string dependencyTarget;
@@ -1061,7 +1061,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
cmList compileCommands;
std::string const& compileRule = this->Makefile->GetRequiredDefinition(
"CMAKE_" + lang + "_COMPILE_OBJECT");
cmStrCat("CMAKE_", lang, "_COMPILE_OBJECT"));
compileCommands.assign(compileRule);
if (this->GeneratorTarget->GetPropertyAsBool("EXPORT_COMPILE_COMMANDS") &&
@@ -1078,13 +1078,13 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
compileCommand.replace(lfPos, langFlags.size(),
this->GetFlags(lang, this->GetConfigName()));
}
std::string const langDefines = std::string("$(") + lang + "_DEFINES)";
std::string const langDefines = cmStrCat("$(", lang, "_DEFINES)");
std::string::size_type const ldPos = compileCommand.find(langDefines);
if (ldPos != std::string::npos) {
compileCommand.replace(ldPos, langDefines.size(),
this->GetDefines(lang, this->GetConfigName()));
}
std::string const langIncludes = std::string("$(") + lang + "_INCLUDES)";
std::string const langIncludes = cmStrCat("$(", lang, "_INCLUDES)");
std::string::size_type const liPos = compileCommand.find(langIncludes);
if (liPos != std::string::npos) {
compileCommand.replace(liPos, langIncludes.size(),
@@ -2147,7 +2147,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
{
// Check for an explicit setting one way or the other.
std::string const responseVar =
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS";
cmStrCat("CMAKE_", l, "_USE_RESPONSE_FILE_FOR_OBJECTS");
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
return val.IsOn();
@@ -2186,7 +2186,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
{
// Check for an explicit setting one way or the other.
std::string const responseVar =
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
cmStrCat("CMAKE_", l, "_USE_RESPONSE_FILE_FOR_LIBRARIES");
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
return val.IsOn();
@@ -2253,7 +2253,7 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
std::string linkPath;
this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
frameworkPath, linkPath);
linkLibs = frameworkPath + linkPath + linkLibs;
linkLibs = cmStrCat(frameworkPath, linkPath, linkLibs);
}
if (useResponseFile &&
@@ -2343,9 +2343,9 @@ bool cmMakefileTargetGenerator::CreateRustLinkArguments(
this->GeneratorTarget->GetRustMainCrateRoot(this->GetConfigName());
if (!mainCrateRoot) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
"Target " +
this->GeneratorTarget->GetName() +
" has no main crate root.");
cmStrCat("Target ",
this->GeneratorTarget->GetName(),
" has no main crate root."));
return false;
}
rustMainCrateRootPath = mainCrateRoot->GetFullPath();
@@ -2377,7 +2377,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
if (useResponseFile) {
std::string const responseFlagVar =
"CMAKE_" + lang + "_RESPONSE_FILE_FLAG";
cmStrCat("CMAKE_", lang, "_RESPONSE_FILE_FLAG");
std::string responseFlag =
this->Makefile->GetSafeDefinition(responseFlagVar);
if (responseFlag.empty()) {
+2 -2
View File
@@ -55,8 +55,8 @@ void ReportCheckResult(cm::string_view what, std::string result,
cmMakefile& mf)
{
if (mf.GetCMakeInstance()->HasCheckInProgress()) {
auto text = mf.GetCMakeInstance()->GetTopCheckInProgressMessage() + " - " +
std::move(result);
auto text = cmStrCat(mf.GetCMakeInstance()->GetTopCheckInProgressMessage(),
" - ", std::move(result));
mf.DisplayStatus(IndentText(std::move(text), mf), -1);
} else {
mf.GetMessenger()->DisplayMessage(
+8 -7
View File
@@ -268,7 +268,7 @@ bool cmNinjaNormalTargetGenerator::CheckUseResponseFileForLibraries(
{
// Check for an explicit setting one way or the other.
std::string const responseVar =
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
cmStrCat("CMAKE_", l, "_USE_RESPONSE_FILE_FOR_LIBRARIES");
// If the option is defined, read it's value
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
@@ -865,8 +865,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
globalGen->ConfigDirectory(config), '/'));
targetOutputDir = globalGen->ExpandCFGIntDir(targetOutputDir, config);
std::string targetOutputReal =
this->ConvertToNinjaPath(targetOutputDir + "cmake_device_link" + objExt);
std::string targetOutputReal = this->ConvertToNinjaPath(
cmStrCat(targetOutputDir, "cmake_device_link", objExt));
if (firstForConfig) {
globalGen->GetByproductsForCleanTarget(config).push_back(targetOutputReal);
@@ -1310,9 +1310,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// step.
cmSourceFile const* mainCrateRoot = gt->GetRustMainCrateRoot(config);
if (!mainCrateRoot) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
"Target " + gt->GetName() +
" has no main crate root.");
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("Target ", gt->GetName(), " has no main crate root."));
return;
}
std::string mainCrateRootPath =
@@ -1470,7 +1470,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
if (cmValue d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
dbg_suffix = *d;
}
vars["TARGET_PDB"] = components.base + components.suffix + dbg_suffix;
vars["TARGET_PDB"] =
cmStrCat(components.base, components.suffix, dbg_suffix);
}
std::string const objPath =
+3 -2
View File
@@ -72,8 +72,9 @@ void cmOSXBundleGenerator::CreateFramework(
this->GT->GetFrameworkDirectory(config, cmGeneratorTarget::ContentLevel),
'/');
std::string newoutpath = outpath + "/" +
this->GT->GetFrameworkDirectory(config, cmGeneratorTarget::FullLevel);
std::string newoutpath = cmStrCat(
outpath, '/',
this->GT->GetFrameworkDirectory(config, cmGeneratorTarget::FullLevel));
std::string frameworkVersion = this->GT->GetFrameworkVersion();
+7 -7
View File
@@ -106,8 +106,8 @@ bool cmProjectCommand(std::vector<std::string> const& args,
return false;
}
if (!IncludeByVariable(status,
"CMAKE_PROJECT_" + projectName + "_INCLUDE_BEFORE")) {
if (!IncludeByVariable(
status, cmStrCat("CMAKE_PROJECT_", projectName, "_INCLUDE_BEFORE"))) {
return false;
}
@@ -202,7 +202,7 @@ bool cmProjectCommand(std::vector<std::string> const& args,
if (prArgs.Version) {
if (!vx.find(*prArgs.Version)) {
std::string e =
R"(VERSION ")" + *prArgs.Version + R"(" format invalid.)";
cmStrCat(R"(VERSION ")", *prArgs.Version, R"(" format invalid.)");
mf.IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccurred();
return true;
@@ -242,8 +242,8 @@ bool cmProjectCommand(std::vector<std::string> const& args,
if (prArgs.CompatVersion) {
if (!vx.find(*prArgs.CompatVersion)) {
std::string e =
R"(COMPAT_VERSION ")" + *prArgs.CompatVersion + R"(" format invalid.)";
std::string e = cmStrCat(R"(COMPAT_VERSION ")", *prArgs.CompatVersion,
R"(" format invalid.)");
mf.IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccurred();
return true;
@@ -319,8 +319,8 @@ bool cmProjectCommand(std::vector<std::string> const& args,
return false;
}
if (!IncludeByVariable(status,
"CMAKE_PROJECT_" + projectName + "_INCLUDE")) {
if (!IncludeByVariable(
status, cmStrCat("CMAKE_PROJECT_", projectName, "_INCLUDE"))) {
return false;
}
+1 -1
View File
@@ -961,7 +961,7 @@ bool cmQtAutoGenInitializer::InitRcc()
this->GenTarget->GetSafeProperty(kw.AUTORCC_OPTIONS);
std::string const nozstd = "--no-zstd";
if (rccOptions.find(nozstd) == std::string::npos) {
rccOptions.append(";" + nozstd + ";");
rccOptions.append(cmStrCat(';', nozstd, ';'));
}
this->GenTarget->Target->SetProperty(kw.AUTORCC_OPTIONS, rccOptions);
}
+6 -5
View File
@@ -1442,7 +1442,7 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::EvalSource(
this->MocConst().MacrosString(),
" macro.\nRunning moc on the header\n ",
this->MessagePath(headerHandle->FileName), "!\nBetter include ",
this->MessagePath("moc_" + incKey.Base + ".cpp"),
this->MessagePath(cmStrCat("moc_", incKey.Base, ".cpp")),
" for a compatibility with regular mode.\n"
"This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
} else {
@@ -1451,10 +1451,10 @@ bool cmQtAutoMocUicT::JobEvalCacheMocT::EvalSource(
cmStrCat(
this->MessagePath(sourceFile.FileName), "\nincludes the moc file ",
this->MessagePath(incKey.Key), " instead of ",
this->MessagePath("moc_" + incKey.Base + ".cpp"),
this->MessagePath(cmStrCat("moc_", incKey.Base, ".cpp")),
".\nRunning moc on the header\n ",
this->MessagePath(headerHandle->FileName), "!\nBetter include ",
this->MessagePath("moc_" + incKey.Base + ".cpp"),
this->MessagePath(cmStrCat("moc_", incKey.Base, ".cpp")),
" for compatibility with regular mode.\n"
"This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n"));
}
@@ -2223,8 +2223,9 @@ void cmQtAutoMocUicT::JobCompileMocT::Process()
}
if (!cmSystemTools::FileExists(depfile)) {
this->Log().Warning(GenT::MOC,
"Dependency file " + this->MessagePath(depfile) +
" does not exist.");
cmStrCat("Dependency file ",
this->MessagePath(depfile),
" does not exist."));
return;
}
this->CacheEntry->Moc.Depends =
+2 -2
View File
@@ -115,7 +115,7 @@ void cmRST::ProcessModule(std::istream& is)
if (line == "#.rst:") {
rst = "#";
} else if (this->ModuleRST.find(line)) {
rst = "]" + this->ModuleRST.match(1) + "]";
rst = cmStrCat(']', this->ModuleRST.match(1), ']');
}
}
}
@@ -403,7 +403,7 @@ bool cmRST::ProcessInclude(std::string file, Include type)
if (file[0] == '/') {
file = this->DocRoot + file;
} else {
file = this->DocDir + "/" + file;
file = cmStrCat(this->DocDir, '/', file);
}
found = r.ProcessFile(file, type == Include::Module);
if (type == Include::TocTree) {
+1 -1
View File
@@ -655,7 +655,7 @@ void cmSbomBuilder::ResolveTargetsInGeneratorExpressions(
} else {
this->ResolveTargetsInGeneratorExpression(li, target, lg);
}
input += sep + li;
input = cmStrCat(input, sep, li);
sep = ";";
}
}
+4 -4
View File
@@ -35,17 +35,17 @@ bool cmSubdirCommand(std::vector<std::string> const& args,
}
// if they specified a relative path then compute the full
std::string srcPath = mf.GetCurrentSourceDirectory() + "/" + i;
std::string srcPath = cmStrCat(mf.GetCurrentSourceDirectory(), '/', i);
if (cmSystemTools::FileIsDirectory(srcPath)) {
std::string binPath = mf.GetCurrentBinaryDirectory() + "/" + i;
std::string binPath = cmStrCat(mf.GetCurrentBinaryDirectory(), '/', i);
mf.AddSubDirectory(srcPath, binPath, excludeFromAll, false, false);
}
// otherwise it is a full path
else if (cmSystemTools::FileIsDirectory(i)) {
// we must compute the binPath from the srcPath, we just take the last
// element from the source path and use that
std::string binPath = mf.GetCurrentBinaryDirectory() + "/" +
cmSystemTools::GetFilenameName(i);
std::string binPath = cmStrCat(mf.GetCurrentBinaryDirectory(), '/',
cmSystemTools::GetFilenameName(i));
mf.AddSubDirectory(i, binPath, excludeFromAll, false, false);
} else {
status.SetError(cmStrCat("Incorrect SUBDIRS command. Directory: ", i,
+1 -2
View File
@@ -2726,8 +2726,7 @@ bool extract_tar(std::string const& arFileName,
while ((ar = archive_match_path_unmatched_inclusions_next(matching, &p)) ==
ARCHIVE_OK) {
cmSystemTools::Error("tar: " + std::string(p) +
": Not found in archive");
cmSystemTools::Error(cmStrCat("tar: ", p, ": Not found in archive"));
error_occurred = true;
}
if (error_occurred) {
+12 -12
View File
@@ -1550,24 +1550,24 @@ std::string cmTarget::GetDebugGeneratorExpressions(
std::vector<std::string> debugConfigs =
this->impl->Makefile->GetCMakeInstance()->GetDebugConfigs();
std::string configString = "$<CONFIG:" + debugConfigs[0] + ">";
std::string configString = cmStrCat("$<CONFIG:", debugConfigs[0], '>');
if (debugConfigs.size() > 1) {
for (std::string const& conf : cmMakeRange(debugConfigs).advance(1)) {
configString += ",$<CONFIG:" + conf + ">";
configString = cmStrCat(configString, ",$<CONFIG:", conf, '>');
}
configString = "$<OR:" + configString + ">";
configString = cmStrCat("$<OR:", configString, '>');
}
if (llt == OPTIMIZED_LibraryType) {
configString = "$<NOT:" + configString + ">";
configString = cmStrCat("$<NOT:", configString, '>');
}
return "$<" + configString + ":" + value + ">";
return cmStrCat("$<", configString, ':', value, '>');
}
static std::string targetNameGenex(std::string const& lib)
{
return "$<TARGET_NAME:" + lib + ">";
return cmStrCat("$<TARGET_NAME:", lib, '>');
}
bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
@@ -2528,7 +2528,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
dirs += this->impl->Makefile->GetCurrentSourceDirectory();
if (!dirs.empty()) {
this->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
("$<BUILD_INTERFACE:" + dirs + ">"));
(cmStrCat("$<BUILD_INTERFACE:", dirs, '>')));
}
}
}
@@ -3525,16 +3525,16 @@ bool cmTargetInternals::CheckImportedLibName(std::string const& prop,
if (!value.empty()) {
if (value[0] == '-') {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
prop + " property value\n " + value +
"\nmay not start with '-'.");
cmStrCat(prop, " property value\n ", value,
"\nmay not start with '-'."));
return false;
}
std::string::size_type bad = value.find_first_of(":/\\;");
if (bad != std::string::npos) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,
prop + " property value\n " + value +
"\nmay not contain '" +
value.substr(bad, 1) + "'.");
cmStrCat(prop, " property value\n ", value,
"\nmay not contain '",
value.substr(bad, 1), "'."));
return false;
}
}
+2 -2
View File
@@ -42,9 +42,9 @@ private:
std::string sep;
for (std::string const& it : content) {
if (cmHasLiteralPrefix(it, "-D")) {
defs += sep + it.substr(2);
defs = cmStrCat(defs, sep, it.substr(2));
} else {
defs += sep + it;
defs = cmStrCat(defs, sep, it);
}
sep = ";";
}
+1 -1
View File
@@ -462,7 +462,7 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
this->Target->GetDebugGeneratorExpressions(lib, llt);
if (cmGeneratorExpression::IsValidTargetName(lib) ||
cmGeneratorExpression::Find(lib) != std::string::npos) {
configLib = "$<LINK_ONLY:" + configLib + ">";
configLib = cmStrCat("$<LINK_ONLY:", configLib, '>');
}
this->AppendProperty("INTERFACE_LINK_LIBRARIES", configLib);
}
+2 -1
View File
@@ -518,7 +518,8 @@ void TryRunCommandImpl::DoNotRunExecutable(
"appropriately:\n ",
this->RunResultVariable, " (advanced)\n");
if (out) {
errorMessage += " " + internalRunOutputName + " (advanced)\n";
errorMessage =
cmStrCat(errorMessage, " ", internalRunOutputName, " (advanced)\n");
}
errorMessage += detailsString;
cmSystemTools::Error(errorMessage);
+1 -1
View File
@@ -979,7 +979,7 @@ bool cmake::FindPackage(std::vector<std::string> const& args)
lg->GetStateSnapshot().GetDirectory());
lg->GetTargetFlags(&linkLineComputer, buildType, linkLibs, flags,
linkFlags, frameworkPath, linkPath, gtgt);
linkLibs = frameworkPath + linkPath + linkLibs;
linkLibs = cmStrCat(frameworkPath, linkPath, linkLibs);
printf("%s\n", linkLibs.c_str());
+2 -2
View File
@@ -3400,8 +3400,8 @@ int cmVSLink::LinkNonIncremental()
}
// Run the manifest tool to embed the final manifest in the binary.
std::string mtOut = "/outputresource:" + this->TargetFile +
(this->Type == 1 ? ";#1" : ";#2");
std::string mtOut = cmStrCat("/outputresource:", this->TargetFile,
(this->Type == 1 ? ";#1" : ";#2"));
return this->RunMT(mtOut, false);
}
+2 -1
View File
@@ -9,6 +9,7 @@
#include "cmsys/FStream.hxx"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class CompileCommandParser
@@ -102,7 +103,7 @@ private:
void ExpectOrDie(char c, std::string const& message)
{
if (!this->Expect(c)) {
this->ErrorExit(std::string("'") + c + "' expected " + message + ".");
this->ErrorExit(cmStrCat('\'', c, "' expected ", message, '.'));
}
}
+3 -2
View File
@@ -25,6 +25,7 @@
# include "cmDebuggerPosixPipeConnection.h"
#endif
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#ifdef _WIN32
@@ -36,8 +37,8 @@ static void sendCommands(std::shared_ptr<dap::ReaderWriter> const& debugger,
std::vector<std::string> const& initCommands)
{
for (auto const& command : initCommands) {
std::string contentLength = "Content-Length:";
contentLength += std::to_string(command.size()) + "\r\n\r\n";
std::string contentLength =
cmStrCat("Content-Length:", command.size(), "\r\n\r\n");
debugger->write(contentLength.c_str(), contentLength.size());
if (!debugger->write(command.c_str(), command.size())) {
std::cout << "debugger write error" << std::endl;