Commit da26b3be authored by Rolf Eike Beer's avatar Rolf Eike Beer

avoid adding multiple consecutive string literals to std::string

While at it change some single character additions to be of type char.
parent 06e32a08
Pipeline #144088 passed with stage
......@@ -2223,8 +2223,7 @@ int cmCTestCoverageHandler::GetLabelId(std::string const& label)
void cmCTestCoverageHandler::LoadLabels()
{
std::string fileList = this->CTest->GetBinaryDir();
fileList += "/CMakeFiles";
fileList += "/TargetDirectories.txt";
fileList += "/CMakeFiles/TargetDirectories.txt";
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" target directory list [" << fileList << "]\n",
this->Quiet);
......
......@@ -283,8 +283,7 @@ void cmCTestLaunch::LoadLabels()
// Labels are listed in per-target files.
std::string fname = this->OptionBuildDir;
fname += "/CMakeFiles";
fname += "/";
fname += "/CMakeFiles/";
fname += this->OptionTargetName;
fname += ".dir/Labels.txt";
......
......@@ -27,8 +27,7 @@ cmCacheManager::cmCacheManager()
void cmCacheManager::CleanCMakeFiles(const std::string& path)
{
std::string glob = path;
glob += "/CMakeFiles";
glob += "/*.cmake";
glob += "/CMakeFiles/*.cmake";
cmsys::Glob globIt;
globIt.FindFiles(glob);
std::vector<std::string> files = globIt.GetFiles();
......
......@@ -411,8 +411,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// compute the binary dir when TRY_COMPILE is called with a src file
// signature
if (this->SrcFileSignature) {
this->BinaryDirectory += "/CMakeFiles";
this->BinaryDirectory += "/CMakeTmp";
this->BinaryDirectory += "/CMakeFiles/CMakeTmp";
} else {
// only valid for srcfile signatures
if (!compileDefs.empty()) {
......
......@@ -469,8 +469,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
// TODO: should work without temp file, but just on a memory buffer
std::string binaryFileName =
status.GetMakefile().GetCurrentBinaryDirectory();
binaryFileName += "/CMakeFiles";
binaryFileName += "/FileCommandStringsBinaryFile";
binaryFileName += "/CMakeFiles/FileCommandStringsBinaryFile";
if (cmHexFileConverter::TryConvert(fileName, binaryFileName)) {
fileName = binaryFileName;
}
......
......@@ -6442,8 +6442,7 @@ bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const
std::string cmGeneratorTarget::GetSupportDirectory() const
{
std::string dir = this->LocalGenerator->GetCurrentBinaryDirectory();
dir += "/CMakeFiles";
dir += "/";
dir += "/CMakeFiles/";
dir += this->GetName();
#if defined(__VMS)
dir += "_dir";
......
......@@ -522,7 +522,7 @@ void cmGlobalGenerator::EnableLanguage(
if (!this->ConfiguredFilesPath.empty()) {
rootBin = this->ConfiguredFilesPath;
}
rootBin += "/";
rootBin += '/';
rootBin += cmVersion::GetCMakeVersion();
// set the dir for parent files so they can be used by modules
......@@ -1278,8 +1278,7 @@ void cmGlobalGenerator::Configure()
const char* logs[] = { "CMakeOutput.log", "CMakeError.log", nullptr };
for (const char** log = logs; *log; ++log) {
std::string f = this->CMakeInstance->GetHomeOutputDirectory();
f += "/CMakeFiles";
f += "/";
f += "/CMakeFiles/";
f += *log;
if (cmSystemTools::FileExists(f)) {
msg << "\nSee also \"" << f << "\".";
......@@ -2853,8 +2852,7 @@ void cmGlobalGenerator::CheckRuleHashes()
#if !defined(CMAKE_BOOTSTRAP)
std::string home = this->GetCMakeInstance()->GetHomeOutputDirectory();
std::string pfile = home;
pfile += "/CMakeFiles";
pfile += "/CMakeRuleHashes.txt";
pfile += "/CMakeFiles/CMakeRuleHashes.txt";
this->CheckRuleHashes(pfile, home);
this->WriteRuleHashes(pfile);
#endif
......@@ -2931,8 +2929,7 @@ void cmGlobalGenerator::WriteSummary()
{
// Record all target directories in a central location.
std::string fname = this->CMakeInstance->GetHomeOutputDirectory();
fname += "/CMakeFiles";
fname += "/TargetDirectories.txt";
fname += "/CMakeFiles/TargetDirectories.txt";
cmGeneratedFileStream fout(fname);
for (cmLocalGenerator* lg : this->LocalGenerators) {
......
......@@ -147,9 +147,7 @@ void cmGlobalUnixMakefileGenerator3::Generate()
}
for (cmLocalGenerator* lg : this->LocalGenerators) {
std::string markFileName = lg->GetCurrentBinaryDirectory();
markFileName += "/";
markFileName += "/CMakeFiles";
markFileName += "/progress.marks";
markFileName += "/CMakeFiles/progress.marks";
cmGeneratedFileStream markFile(markFileName);
markFile << this->CountProgressMarksInAll(lg) << "\n";
}
......@@ -198,8 +196,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
// see if the build system must be regenerated.
std::string makefileName =
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += "/CMakeFiles";
makefileName += "/Makefile2";
makefileName += "/CMakeFiles/Makefile2";
cmGeneratedFileStream makefileStream(makefileName, false,
this->GetMakefileEncoding());
if (!makefileStream) {
......@@ -258,8 +255,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// see if the build system must be regenerated.
std::string cmakefileName =
this->GetCMakeInstance()->GetHomeOutputDirectory();
cmakefileName += "/CMakeFiles";
cmakefileName += "/Makefile.cmake";
cmakefileName += "/CMakeFiles/Makefile.cmake";
cmGeneratedFileStream cmakefileStream(cmakefileName);
if (!cmakefileStream) {
return;
......@@ -320,8 +316,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Build the path to the cache check file.
std::string check = this->GetCMakeInstance()->GetHomeOutputDirectory();
check += "/CMakeFiles";
check += "/cmake.check_cache";
check += "/CMakeFiles/cmake.check_cache";
// Set the corresponding makefile in the cmake file.
cmakefileStream << "# The corresponding makefile is:\n"
......@@ -352,8 +347,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
for (cmLocalGenerator* localGen : this->LocalGenerators) {
lg = static_cast<cmLocalUnixMakefileGenerator3*>(localGen);
tmpStr = lg->GetCurrentBinaryDirectory();
tmpStr += "/CMakeFiles";
tmpStr += "/CMakeDirectoryInformation.cmake";
tmpStr += "/CMakeFiles/CMakeDirectoryInformation.cmake";
cmakefileStream << " \""
<< lg->MaybeConvertToRelativePath(binDir, tmpStr)
<< "\"\n";
......
......@@ -1038,8 +1038,7 @@ std::string cmGlobalVisualStudio10Generator::GenerateRuleFile(
// The VS 10 generator needs to create the .rule files on disk.
// Hide them away under the CMakeFiles directory.
std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory();
ruleDir += "/CMakeFiles";
ruleDir += "/";
ruleDir += "/CMakeFiles/";
ruleDir += cmSystemTools::ComputeStringMD5(
cmSystemTools::GetFilenamePath(output).c_str());
std::string ruleFile = ruleDir + "/";
......
......@@ -1399,8 +1399,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
// language.
cmMakefile* mf = gtgt->Target->GetMakefile();
std::string fname = gtgt->GetLocalGenerator()->GetCurrentBinaryDirectory();
fname += "/CMakeFiles";
fname += "/";
fname += "/CMakeFiles/";
fname += gtgt->GetName();
fname += "-CMakeForceLinker";
fname += ".";
......@@ -3701,8 +3700,7 @@ std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(
cmGeneratorTarget* target)
{
std::string plist = target->GetLocalGenerator()->GetCurrentBinaryDirectory();
plist += "/CMakeFiles";
plist += "/";
plist += "/CMakeFiles/";
plist += target->GetName();
plist += ".dir/Info.plist";
return plist;
......
......@@ -57,8 +57,7 @@ void cmInstallExportGenerator::ComputeTempDir()
// Choose a temporary directory in which to generate the import
// files to be installed.
this->TempDir = this->LocalGenerator->GetCurrentBinaryDirectory();
this->TempDir += "/CMakeFiles";
this->TempDir += "/Export";
this->TempDir += "/CMakeFiles/Export";
if (this->Destination.empty()) {
return;
}
......
......@@ -88,8 +88,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
if (this->Target->NeedRelinkBeforeInstall(config)) {
fromDirConfig =
this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
fromDirConfig += "/CMakeFiles";
fromDirConfig += "/CMakeRelink.dir/";
fromDirConfig += "/CMakeFiles/CMakeRelink.dir/";
} else {
cmStateEnums::ArtifactType artifact = this->ImportLibrary
? cmStateEnums::ImportLibraryArtifact
......
......@@ -428,8 +428,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
{
std::string infoFileName = this->GetCurrentBinaryDirectory();
infoFileName += "/CMakeFiles";
infoFileName += "/CMakeDirectoryInformation.cmake";
infoFileName += "/CMakeFiles/CMakeDirectoryInformation.cmake";
// Open the output file.
cmGeneratedFileStream infoFileStream(infoFileName);
......@@ -1345,8 +1344,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(
bool needRescanDirInfo = false;
{
std::string dirInfoFile = this->GetCurrentBinaryDirectory();
dirInfoFile += "/CMakeFiles";
dirInfoFile += "/CMakeDirectoryInformation.cmake";
dirInfoFile += "/CMakeFiles/CMakeDirectoryInformation.cmake";
int result;
if (!ftc->Compare(internalDependFile, dirInfoFile, &result) ||
result < 0) {
......@@ -1411,8 +1409,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
bool haveDirectoryInfo = false;
{
std::string dirInfoFile = this->GetCurrentBinaryDirectory();
dirInfoFile += "/CMakeFiles";
dirInfoFile += "/CMakeDirectoryInformation.cmake";
dirInfoFile += "/CMakeFiles/CMakeDirectoryInformation.cmake";
if (mf->ReadListFile(dirInfoFile) &&
!cmSystemTools::GetErrorOccuredFlag()) {
haveDirectoryInfo = true;
......@@ -1641,8 +1638,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
progCmd << this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL);
std::string progressFile = "/CMakeFiles";
progressFile += "/progress.marks";
std::string progressFile = "/CMakeFiles/progress.marks";
std::string progressFileNameFull = this->ConvertToFullPath(progressFile);
progCmd << " "
<< this->ConvertToOutputFormat(
......@@ -1650,8 +1646,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
cmOutputConverter::SHELL);
commands.push_back(progCmd.str());
}
std::string mf2Dir = "CMakeFiles/";
mf2Dir += "Makefile2";
std::string mf2Dir = "CMakeFiles/Makefile2";
commands.push_back(this->GetRecursiveMakeCall(mf2Dir, recursiveTarget));
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
......
......@@ -98,8 +98,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force_commands.push_back(force_command);
std::string no_main_dependency;
std::string force = this->GetCurrentBinaryDirectory();
force += "/CMakeFiles";
force += "/";
force += "/CMakeFiles/";
force += l->GetName();
force += "_force";
if (cmSourceFile* file = this->Makefile->AddCustomCommandToOutput(
......@@ -147,8 +146,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
std::string stampName = this->GetCurrentBinaryDirectory();
stampName += "/CMakeFiles";
cmSystemTools::MakeDirectory(stampName.c_str());
stampName += "/";
stampName += "generate.stamp";
stampName += "/generate.stamp";
cmsys::ofstream stamp(stampName.c_str());
stamp << "# CMake generation timestamp file for this directory.\n";
......
......@@ -1182,8 +1182,7 @@ cmTarget* cmMakefile::AddUtilityCommand(
// Store the custom command in the target.
if (!commandLines.empty() || !depends.empty()) {
std::string force = this->GetCurrentBinaryDirectory();
force += "/CMakeFiles";
force += "/";
force += "/CMakeFiles/";
force += utilityName;
std::vector<std::string> forced;
forced.push_back(force);
......
......@@ -297,14 +297,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if (this->GeneratorTarget->IsAppBundleOnApple()) {
this->OSXBundleGenerator->CreateAppBundle(targetNames.Output, outpath);
}
outpath += "/";
outpath += '/';
std::string outpathImp;
if (relink) {
outpath = this->Makefile->GetCurrentBinaryDirectory();
outpath += "/CMakeFiles";
outpath += "/CMakeRelink.dir";
outpath += "/CMakeFiles/CMakeRelink.dir";
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
outpath += '/';
if (!targetNames.ImportLibrary.empty()) {
outpathImp = outpath;
}
......@@ -314,7 +313,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
cmSystemTools::MakeDirectory(outpathImp);
outpathImp += "/";
outpathImp += '/';
}
}
......@@ -325,7 +324,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string pdbOutputPath =
this->GeneratorTarget->GetPDBDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
pdbOutputPath += '/';
std::string targetFullPath = outpath + targetNames.Output;
std::string targetFullPathReal = outpath + targetNames.Real;
......
......@@ -465,30 +465,29 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output,
outpath);
outpath += "/";
outpath += '/';
} else if (this->GeneratorTarget->IsCFBundleOnApple()) {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output,
outpath);
outpath += "/";
outpath += '/';
} else if (relink) {
outpath = this->Makefile->GetCurrentBinaryDirectory();
outpath += "/CMakeFiles";
outpath += "/CMakeRelink.dir";
outpath += "/CMakeFiles/CMakeRelink.dir";
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
outpath += '/';
if (!this->TargetNames.ImportLibrary.empty()) {
outpathImp = outpath;
}
} else {
outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(outpath);
outpath += "/";
outpath += '/';
if (!this->TargetNames.ImportLibrary.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
this->ConfigName, cmStateEnums::ImportLibraryArtifact);
cmSystemTools::MakeDirectory(outpathImp);
outpathImp += "/";
outpathImp += '/';
}
}
......
......@@ -37,8 +37,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
cmGeneratorTarget* genTarget = this->GetGeneratorTarget();
std::string utilCommandName = lg->GetCurrentBinaryDirectory();
utilCommandName += "/CMakeFiles";
utilCommandName += "/";
utilCommandName += "/CMakeFiles/";
utilCommandName += this->GetTargetName() + ".util";
utilCommandName = this->ConvertToNinjaPath(utilCommandName);
......
......@@ -294,11 +294,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
// Info directory
this->Dir.Info = cbd;
this->Dir.Info += "/CMakeFiles";
this->Dir.Info += '/';
this->Dir.Info += "/CMakeFiles/";
this->Dir.Info += this->Target->GetName();
this->Dir.Info += "_autogen";
this->Dir.Info += ".dir";
this->Dir.Info += "_autogen.dir";
cmSystemTools::ConvertToUnixSlashes(this->Dir.Info);
// Build directory
......
......@@ -215,8 +215,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
// removed at the end of TRY_RUN and the user can run it manually
// on the target platform.
std::string copyDest = this->Makefile->GetHomeOutputDirectory();
copyDest += "/CMakeFiles";
copyDest += "/";
copyDest += "/CMakeFiles/";
copyDest += cmSystemTools::GetFilenameWithoutExtension(this->OutputFile);
copyDest += "-";
copyDest += this->RunResultVariable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment