strings: combine string literals

This commit is contained in:
Ben Boeckel
2023-07-26 15:40:56 -04:00
parent e1b70d7286
commit 1b60137b98
3 changed files with 59 additions and 41 deletions

View File

@@ -86,24 +86,28 @@ int cmCPackBundleGenerator::ConstructBundle()
std::string const staging = toplevel;
std::ostringstream contents;
contents << staging << "/" << cpack_bundle_name << ".app/"
<< "Contents";
contents << staging << "/" << cpack_bundle_name
<< ".app/"
"Contents";
std::ostringstream application;
application << contents.str() << "/"
<< "MacOS";
application << contents.str()
<< "/"
"MacOS";
std::ostringstream resources;
resources << contents.str() << "/"
<< "Resources";
resources << contents.str()
<< "/"
"Resources";
// Install a required, user-provided bundle metadata file ...
std::ostringstream plist_source;
plist_source << cpack_bundle_plist;
std::ostringstream plist_target;
plist_target << contents.str() << "/"
<< "Info.plist";
plist_target << contents.str()
<< "/"
"Info.plist";
if (!this->CopyFile(plist_source, plist_target)) {
cmCPackLogger(

View File

@@ -102,10 +102,15 @@ int cmCPackProductBuildGenerator::PackageFiles()
pkgCmd << productbuild << " --distribution \"" << packageDirFileName
<< "/Contents/distribution.dist\""
<< " --package-path \"" << packageDirFileName << "/Contents/Packages"
" --package-path \""
<< packageDirFileName
<< "/Contents/Packages"
"\""
" --resources \""
<< resDir
<< "\""
<< " --resources \"" << resDir << "\""
<< " --version \"" << version << "\""
" --version \""
<< version << "\""
<< (identifier.empty()
? std::string{}
: cmStrCat(" --identifier \"", identifier, '"'))
@@ -236,11 +241,18 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
keychainPath = p;
}
pkgCmd << pkgbuild << " --root \"" << packageDir << "\""
<< " --identifier \"" << pkgId << "\""
<< " --scripts \"" << scriptDir << "\""
<< " --version \"" << version << "\""
<< " --install-location \"/\""
pkgCmd << pkgbuild << " --root \"" << packageDir
<< "\""
" --identifier \""
<< pkgId
<< "\""
" --scripts \""
<< scriptDir
<< "\""
" --version \""
<< version
<< "\""
" --install-location \"/\""
<< (identityName.empty() ? std::string{}
: cmStrCat(" --sign \"", identityName, "\""))
<< (keychainPath.empty()

View File

@@ -721,12 +721,12 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
this->CurrentReRunCMakeMakefile += "/ReRunCMake.make";
cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile);
makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n\n";
makefileStream << "# Generated by CMake, DO NOT EDIT\n\n"
makefileStream << "TARGETS:= \n";
makefileStream << "empty:= \n";
makefileStream << "space:= $(empty) $(empty)\n";
makefileStream << "spaceplus:= $(empty)\\ $(empty)\n\n";
"TARGETS:= \n"
"empty:= \n"
"space:= $(empty) $(empty)\n"
"spaceplus:= $(empty)\\ $(empty)\n\n";
for (const auto& lfile : lfiles) {
makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard "
@@ -738,12 +738,13 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
cmStrCat(root->GetBinaryDirectory(), "/CMakeFiles/cmake.check_cache");
if (cm->DoWriteGlobVerifyTarget()) {
makefileStream << ".NOTPARALLEL:\n\n";
makefileStream << ".PHONY: all VERIFY_GLOBS\n\n";
makefileStream << "all: VERIFY_GLOBS "
<< this->ConvertToRelativeForMake(checkCache) << "\n\n";
makefileStream << "VERIFY_GLOBS:\n";
makefileStream << "\t"
makefileStream << ".NOTPARALLEL:\n\n"
".PHONY: all VERIFY_GLOBS\n\n"
"all: VERIFY_GLOBS "
<< this->ConvertToRelativeForMake(checkCache)
<< "\n\n"
"VERIFY_GLOBS:\n"
"\t"
<< this->ConvertToRelativeForMake(
cmSystemTools::GetCMakeCommand())
<< " -P "
@@ -2218,12 +2219,13 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
return;
}
makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n";
makefileStream << "# Custom rules for " << target->GetName() << "\n";
makefileStream << "# Generated by CMake, DO NOT EDIT\n"
"# Custom rules for "
<< target->GetName() << '\n';
// disable the implicit rules
makefileStream << ".SUFFIXES: "
<< "\n";
"\n";
// have all depend on all outputs
makefileStream << "all: ";
@@ -4696,9 +4698,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
// one more pass for external depend information not handled
// correctly by xcode
/* clang-format off */
makefileStream << "# DO NOT EDIT\n";
makefileStream << "# This makefile makes sure all linkable targets are\n";
makefileStream << "# up-to-date with anything they link to\n"
makefileStream << "# DO NOT EDIT\n"
"# This makefile makes sure all linkable targets are\n"
"# up-to-date with anything they link to\n"
"default:\n"
"\techo \"Do not invoke directly\"\n"
"\n";
@@ -4776,8 +4778,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
}
// Write the action to remove the target if it is out of date.
makefileStream << "\n";
makefileStream << "\t/bin/rm -f "
makefileStream << "\n"
"\t/bin/rm -f "
<< this->ConvertToRelativeForMake(tfull) << "\n";
// if building for more than one architecture
// then remove those executables as well
@@ -4798,8 +4800,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
}
makefileStream << "\n\n"
<< "# For each target create a dummy rule"
<< "so the target does not have to exist\n";
"# For each target create a dummy rule"
"so the target does not have to exist\n";
for (auto const& dummyRule : dummyRules) {
makefileStream << dummyRule << ":\n";
}
@@ -4942,8 +4944,8 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
{
SortXCodeObjects();
fout << "// !$*UTF8*$!\n";
fout << "{\n";
fout << "// !$*UTF8*$!\n"
"{\n";
cmXCodeObject::Indent(1, fout);
fout << "archiveVersion = 1;\n";
cmXCodeObject::Indent(1, fout);
@@ -4955,8 +4957,8 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId()
<< " /* Project object */;\n";
fout << "}\n";
<< " /* Project object */;\n"
"}\n";
}
const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const