cmStrCat: use where possible in Apple-specific sources

This commit is contained in:
Ben Boeckel
2023-07-26 15:39:34 -04:00
parent 3af822cd8f
commit f5d04b5bf0
5 changed files with 82 additions and 73 deletions
+15 -13
View File
@@ -136,8 +136,10 @@ int cmCPackDragNDropGenerator::InitializeInternal()
return 0; return 0;
} }
for (auto const& language : languages) { for (auto const& language : languages) {
std::string license = slaDirectory + "/" + language + ".license.txt"; std::string license =
std::string license_rtf = slaDirectory + "/" + language + ".license.rtf"; cmStrCat(slaDirectory, "/", language, ".license.txt");
std::string license_rtf =
cmStrCat(slaDirectory, "/", language, ".license.rtf");
if (!singleLicense) { if (!singleLicense) {
if (!cmSystemTools::FileExists(license) && if (!cmSystemTools::FileExists(license) &&
!cmSystemTools::FileExists(license_rtf)) { !cmSystemTools::FileExists(license_rtf)) {
@@ -148,7 +150,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
return 0; return 0;
} }
} }
std::string menu = slaDirectory + "/" + language + ".menu.txt"; std::string menu = cmStrCat(slaDirectory, "/", language, ".menu.txt");
if (!cmSystemTools::FileExists(menu)) { if (!cmSystemTools::FileExists(menu)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
"Missing menu file " << language << ".menu.txt" "Missing menu file " << language << ".menu.txt"
@@ -192,7 +194,7 @@ int cmCPackDragNDropGenerator::PackageFiles()
// loop to create dmg files // loop to create dmg files
packageFileNames.clear(); packageFileNames.clear();
for (auto const& package_file : package_files) { for (auto const& package_file : package_files) {
std::string full_package_name = std::string(toplevel) + std::string("/"); std::string full_package_name = cmStrCat(toplevel, "/");
if (package_file == "ALL_IN_ONE") { if (package_file == "ALL_IN_ONE") {
full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME");
} else { } else {
@@ -711,8 +713,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
if (this->componentPackageMethod == ONE_PACKAGE_PER_GROUP) { if (this->componentPackageMethod == ONE_PACKAGE_PER_GROUP) {
// We have to find the name of the COMPONENT GROUP // We have to find the name of the COMPONENT GROUP
// the current COMPONENT belongs to. // the current COMPONENT belongs to.
std::string groupVar = std::string groupVar = cmStrCat(
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; "CPACK_COMPONENT_", cmSystemTools::UpperCase(componentName), "_GROUP");
cmValue _groupName = this->GetOption(groupVar); cmValue _groupName = this->GetOption(groupVar);
if (_groupName) { if (_groupName) {
std::string groupName = _groupName; std::string groupName = _groupName;
@@ -723,8 +725,8 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
} }
} }
std::string componentFileName = std::string componentFileName = cmStrCat(
"CPACK_DMG_" + cmSystemTools::UpperCase(componentName) + "_FILE_NAME"; "CPACK_DMG_", cmSystemTools::UpperCase(componentName), "_FILE_NAME");
if (this->IsSet(componentFileName)) { if (this->IsSet(componentFileName)) {
return this->GetOption(componentFileName); return this->GetOption(componentFileName);
} }
@@ -808,12 +810,12 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber,
actual_license = licenseFile; actual_license = licenseFile;
} else { } else {
std::string license_wo_ext = std::string license_wo_ext =
slaDirectory + "/" + licenseLanguage + ".license"; cmStrCat(slaDirectory, "/", licenseLanguage, ".license");
if (cmSystemTools::FileExists(license_wo_ext + ".txt")) { if (cmSystemTools::FileExists(cmStrCat(license_wo_ext, ".txt"))) {
actual_license = license_wo_ext + ".txt"; actual_license = cmStrCat(license_wo_ext, ".txt");
} else { } else {
licenseArray = &rez.RTF; licenseArray = &rez.RTF;
actual_license = license_wo_ext + ".rtf"; actual_license = cmStrCat(license_wo_ext, ".rtf");
} }
} }
@@ -836,7 +838,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber,
} else { } else {
std::vector<std::string> lines; std::vector<std::string> lines;
std::string actual_menu = std::string actual_menu =
slaDirectory + "/" + licenseLanguage + ".menu.txt"; cmStrCat(slaDirectory, "/", licenseLanguage, ".menu.txt");
if (!this->ReadFile(actual_menu, lines, error)) { if (!this->ReadFile(actual_menu, lines, error)) {
return false; return false;
} }
+14 -13
View File
@@ -38,13 +38,12 @@ std::string cmCPackPKGGenerator::GetPackageName(
if (component.ArchiveFile.empty()) { if (component.ArchiveFile.empty()) {
std::string packagesDir = std::string packagesDir =
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy"); cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy");
std::ostringstream out; return cmStrCat(
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-" cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), "-",
<< component.Name << ".pkg"; component.Name, ".pkg");
return out.str();
} }
return component.ArchiveFile + ".pkg"; return cmStrCat(component.ArchiveFile, ".pkg");
} }
void cmCPackPKGGenerator::CreateBackground(const char* themeName, void cmCPackPKGGenerator::CreateBackground(const char* themeName,
@@ -160,14 +159,15 @@ void cmCPackPKGGenerator::WriteDistributionFile(const char* metapackageFile,
for (auto const& comp : this->Components) { for (auto const& comp : this->Components) {
if (!comp.second.Group) { if (!comp.second.Group) {
xChoiceOut.StartElement("line"); xChoiceOut.StartElement("line");
xChoiceOut.Attribute("choice", comp.first + "Choice"); xChoiceOut.Attribute("choice", cmStrCat(comp.first, "Choice"));
xChoiceOut.Content(""); // Avoid self-closing tag. xChoiceOut.Content(""); // Avoid self-closing tag.
xChoiceOut.EndElement(); xChoiceOut.EndElement();
} }
} }
if (!this->PostFlightComponent.Name.empty()) { if (!this->PostFlightComponent.Name.empty()) {
xChoiceOut.StartElement("line"); xChoiceOut.StartElement("line");
xChoiceOut.Attribute("choice", PostFlightComponent.Name + "Choice"); xChoiceOut.Attribute("choice",
cmStrCat(PostFlightComponent.Name, "Choice"));
xChoiceOut.Content(""); // Avoid self-closing tag. xChoiceOut.Content(""); // Avoid self-closing tag.
xChoiceOut.EndElement(); xChoiceOut.EndElement();
} }
@@ -207,14 +207,14 @@ void cmCPackPKGGenerator::CreateChoiceOutline(
const cmCPackComponentGroup& group, cmXMLWriter& xout) const cmCPackComponentGroup& group, cmXMLWriter& xout)
{ {
xout.StartElement("line"); xout.StartElement("line");
xout.Attribute("choice", group.Name + "Choice"); xout.Attribute("choice", cmStrCat(group.Name, "Choice"));
for (cmCPackComponentGroup* subgroup : group.Subgroups) { for (cmCPackComponentGroup* subgroup : group.Subgroups) {
CreateChoiceOutline(*subgroup, xout); CreateChoiceOutline(*subgroup, xout);
} }
for (cmCPackComponent* comp : group.Components) { for (cmCPackComponent* comp : group.Components) {
xout.StartElement("line"); xout.StartElement("line");
xout.Attribute("choice", comp->Name + "Choice"); xout.Attribute("choice", cmStrCat(comp->Name, "Choice"));
xout.Content(""); // Avoid self-closing tag. xout.Content(""); // Avoid self-closing tag.
xout.EndElement(); xout.EndElement();
} }
@@ -225,7 +225,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponentGroup& group,
cmXMLWriter& xout) cmXMLWriter& xout)
{ {
xout.StartElement("choice"); xout.StartElement("choice");
xout.Attribute("id", group.Name + "Choice"); xout.Attribute("id", cmStrCat(group.Name, "Choice"));
xout.Attribute("title", group.DisplayName); xout.Attribute("title", group.DisplayName);
xout.Attribute("start_selected", "true"); xout.Attribute("start_selected", "true");
xout.Attribute("start_enabled", "true"); xout.Attribute("start_enabled", "true");
@@ -249,7 +249,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
} }
xout.StartElement("choice"); xout.StartElement("choice");
xout.Attribute("id", component.Name + "Choice"); xout.Attribute("id", cmStrCat(component.Name, "Choice"));
xout.Attribute("title", component.DisplayName); xout.Attribute("title", component.DisplayName);
xout.Attribute( xout.Attribute(
"start_selected", "start_selected",
@@ -381,7 +381,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
const std::string& dirName) const std::string& dirName)
{ {
std::string uname = cmSystemTools::UpperCase(name); std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; std::string cpackVar = cmStrCat("CPACK_RESOURCE_FILE_", uname);
cmValue inFileName = this->GetOption(cpackVar); cmValue inFileName = this->GetOption(cpackVar);
if (!inFileName) { if (!inFileName) {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -413,7 +413,8 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
// Set this so that distribution.dist gets the right name (without // Set this so that distribution.dist gets the right name (without
// the path). // the path).
this->SetOption("CPACK_RESOURCE_FILE_" + uname + "_NOPATH", (name + ext)); this->SetOption(cmStrCat("CPACK_RESOURCE_FILE_", uname, "_NOPATH"),
cmStrCat(name, ext));
cmCPackLogger(cmCPackLog::LOG_VERBOSE, cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Configure file: " << (inFileName ? *inFileName : "(NULL)") "Configure file: " << (inFileName ? *inFileName : "(NULL)")
+16 -10
View File
@@ -58,7 +58,7 @@ int cmCPackProductBuildGenerator::PackageFiles()
} }
} }
std::string resDir = packageDirFileName + "/Contents"; std::string resDir = cmStrCat(packageDirFileName, "/Contents");
if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) { if (this->IsSet("CPACK_PRODUCTBUILD_RESOURCES_DIR")) {
std::string userResDir = std::string userResDir =
@@ -106,10 +106,14 @@ int cmCPackProductBuildGenerator::PackageFiles()
<< "\"" << "\""
<< " --resources \"" << resDir << "\"" << " --resources \"" << resDir << "\""
<< " --version \"" << version << "\"" << " --version \"" << version << "\""
<< (identifier.empty() ? "" : " --identifier \"" + identifier + "\"") << (identifier.empty()
<< (identityName.empty() ? "" : " --sign \"" + identityName + "\"") ? std::string{}
<< (keychainPath.empty() ? "" : cmStrCat(" --identifier \"", identifier, '"'))
: " --keychain \"" + keychainPath + "\"") << (identityName.empty() ? std::string{}
: cmStrCat(" --sign \"", identityName, '"'))
<< (keychainPath.empty()
? std::string{}
: cmStrCat(" --keychain \"", keychainPath, '"'))
<< " \"" << packageFileNames[0] << "\""; << " \"" << packageFileNames[0] << "\"";
// Run ProductBuild // Run ProductBuild
@@ -187,7 +191,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
resDir += "/"; resDir += "/";
resDir += component->Name; resDir += component->Name;
} }
std::string scriptDir = resDir + "/scripts"; std::string scriptDir = cmStrCat(resDir, "/scripts");
if (!cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) { if (!cmsys::SystemTools::MakeDirectory(scriptDir.c_str())) {
cmCPackLogger(cmCPackLog::LOG_ERROR, cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -237,9 +241,11 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
<< " --scripts \"" << scriptDir << "\"" << " --scripts \"" << scriptDir << "\""
<< " --version \"" << version << "\"" << " --version \"" << version << "\""
<< " --install-location \"/\"" << " --install-location \"/\""
<< (identityName.empty() ? "" : " --sign \"" + identityName + "\"") << (identityName.empty() ? std::string{}
<< (keychainPath.empty() ? "" : cmStrCat(" --sign \"", identityName, "\""))
: " --keychain \"" + keychainPath + "\"") << (keychainPath.empty()
? std::string{}
: cmStrCat(" --keychain \"", keychainPath, "\""))
<< " \"" << packageFile << "\""; << " \"" << packageFile << "\"";
if (component && !component->Plist.empty()) { if (component && !component->Plist.empty()) {
@@ -253,7 +259,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
cmValue cmCPackProductBuildGenerator::GetComponentScript( cmValue cmCPackProductBuildGenerator::GetComponentScript(
const char* script, const char* component_name) const char* script, const char* component_name)
{ {
std::string scriptname = std::string("CPACK_") + script + "_"; std::string scriptname = cmStrCat("CPACK_", script, "_");
if (component_name) { if (component_name) {
scriptname += cmSystemTools::UpperCase(component_name); scriptname += cmSystemTools::UpperCase(component_name);
scriptname += "_"; scriptname += "_";
+36 -36
View File
@@ -226,7 +226,8 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
if (commandResult) { if (commandResult) {
std::string::size_type pos = out.find(".app/"); std::string::size_type pos = out.find(".app/");
if (pos != std::string::npos) { if (pos != std::string::npos) {
versionFile = out.substr(0, pos + 5) + "Contents/version.plist"; versionFile =
cmStrCat(out.substr(0, pos + 5), "Contents/version.plist");
} }
} }
} }
@@ -248,7 +249,7 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
if (version_number < 50) { if (version_number < 50) {
cm->IssueMessage(MessageType::FATAL_ERROR, cm->IssueMessage(MessageType::FATAL_ERROR,
"Xcode " + version_string + " not supported."); cmStrCat("Xcode ", version_string, " not supported."));
return std::unique_ptr<cmGlobalGenerator>(); return std::unique_ptr<cmGlobalGenerator>();
} }
@@ -450,7 +451,7 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir,
bool ret = false; bool ret = false;
#ifdef HAVE_APPLICATION_SERVICES #ifdef HAVE_APPLICATION_SERVICES
std::string url = bindir + "/" + projectName + ".xcodeproj"; std::string url = cmStrCat(bindir, "/", projectName, ".xcodeproj");
if (dryRun) { if (dryRun) {
return cmSystemTools::FileExists(url, false); return cmSystemTools::FileExists(url, false);
@@ -852,10 +853,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig)
static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target,
const std::string& fullpath) const std::string& fullpath)
{ {
std::string key(target->GetName()); return cmStrCat(target->GetName(), "-", fullpath);
key += "-";
key += fullpath;
return key;
} }
cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath( cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath(
@@ -943,10 +941,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT");
switch (cmOutputConverter::GetFortranFormat(srcfmt)) { switch (cmOutputConverter::GetFortranFormat(srcfmt)) {
case cmOutputConverter::FortranFormatFixed: case cmOutputConverter::FortranFormatFixed:
flags = "-fixed " + flags; flags = cmStrCat("-fixed ", flags);
break; break;
case cmOutputConverter::FortranFormatFree: case cmOutputConverter::FortranFormatFree:
flags = "-free " + flags; flags = cmStrCat("-free ", flags);
break; break;
default: default:
break; break;
@@ -1278,7 +1276,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
this->GroupMap[key] = group; this->GroupMap[key] = group;
} }
if (!group) { if (!group) {
cmSystemTools::Error("Could not find a PBX group for " + key); cmSystemTools::Error(cmStrCat("Could not find a PBX group for ", key));
return nullptr; return nullptr;
} }
cmXCodeObject* children = group->GetAttribute("children"); cmXCodeObject* children = group->GetAttribute("children");
@@ -2202,10 +2200,10 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
cdir = this->ConvertToRelativeForMake(cdir); cdir = this->ConvertToRelativeForMake(cdir);
std::string makecmd = std::string makecmd = cmStrCat(
cmStrCat("make -C ", cdir, " -f ", "make -C ", cdir, " -f ",
this->ConvertToRelativeForMake((makefile + "$CONFIGURATION")), this->ConvertToRelativeForMake(cmStrCat(makefile, "$CONFIGURATION")),
" OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all"); " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all");
buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
} }
@@ -2243,7 +2241,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
} else { } else {
std::ostringstream str; std::ostringstream str;
str << "_buildpart_" << count++; str << "_buildpart_" << count++;
tname[&ccg.GetCC()] = target->GetName() + str.str(); tname[&ccg.GetCC()] = cmStrCat(target->GetName(), str.str());
makefileStream << "\\\n\t" << tname[&ccg.GetCC()]; makefileStream << "\\\n\t" << tname[&ccg.GetCC()];
} }
} }
@@ -2407,8 +2405,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string llang = gtgt->GetLinkerLanguage(configName); std::string llang = gtgt->GetLinkerLanguage(configName);
if (binary && llang.empty()) { if (binary && llang.empty()) {
cmSystemTools::Error( cmSystemTools::Error(
"CMake can not determine linker language for target: " + cmStrCat("CMake can not determine linker language for target: ",
gtgt->GetName()); gtgt->GetName()));
return; return;
} }
@@ -2472,7 +2470,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::set<std::string> defines(targetSwiftDefines.begin(), std::set<std::string> defines(targetSwiftDefines.begin(),
targetSwiftDefines.end()); targetSwiftDefines.end());
this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift"); this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift");
cflags["Swift"] += " " + defineString; cflags["Swift"] += cmStrCat(" ", defineString);
} else { } else {
BuildObjectListOrString swiftDefs(this, true); BuildObjectListOrString swiftDefs(this, true);
this->AppendDefines(swiftDefs, targetSwiftDefines); this->AppendDefines(swiftDefs, targetSwiftDefines);
@@ -2831,7 +2829,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
includes, gtgt, language, configName); includes, gtgt, language, configName);
if (!includeFlags.empty()) { if (!includeFlags.empty()) {
cflags[language] += " " + includeFlags; cflags[language] += cmStrCat(" ", includeFlags);
} }
} }
} }
@@ -2909,7 +2907,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString("NO")); this->CreateString("NO"));
for (auto const& language : languages) { for (auto const& language : languages) {
std::string flags = cflags[language] + " " + defFlags; std::string flags = cmStrCat(cflags[language], " ", defFlags);
if (language == "CXX" || language == "OBJCXX") { if (language == "CXX" || language == "OBJCXX") {
if (language == "CXX" || if (language == "CXX" ||
!buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) {
@@ -3459,8 +3457,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
{ {
if (value->GetType() != cmXCodeObject::OBJECT_LIST && if (value->GetType() != cmXCodeObject::OBJECT_LIST &&
value->GetType() != cmXCodeObject::STRING) { value->GetType() != cmXCodeObject::STRING) {
cmSystemTools::Error("Unsupported value type for appending: " + cmSystemTools::Error(
std::string(attribute)); cmStrCat("Unsupported value type for appending: ", attribute));
return; return;
} }
if (attr->GetType() == cmXCodeObject::OBJECT_LIST) { if (attr->GetType() == cmXCodeObject::OBJECT_LIST) {
@@ -3483,8 +3481,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
attr->SetString(newValue); attr->SetString(newValue);
} }
} else { } else {
cmSystemTools::Error("Unsupported attribute type for appending: " + cmSystemTools::Error(
std::string(attribute)); cmStrCat("Unsupported attribute type for appending: ", attribute));
} }
} }
@@ -3581,8 +3579,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
useLinkPhase = true; useLinkPhase = true;
forceLinkPhase = true; forceLinkPhase = true;
} else if (*prop != "NONE") { } else if (*prop != "NONE") {
cmSystemTools::Error("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: " + cmSystemTools::Error(
*prop); cmStrCat("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: ", *prop));
return; return;
} }
} }
@@ -3874,8 +3872,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
cmPolicies::PolicyStatus cmp0142 = cmPolicies::PolicyStatus cmp0142 =
target->GetTarget()->GetPolicyStatusCMP0142(); target->GetTarget()->GetPolicyStatusCMP0142();
if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) { if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) {
libSearchPaths.Add(this->XCodeEscapePath( libSearchPaths.Add(this->XCodeEscapePath(cmStrCat(
libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)")); libDir, "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)")));
} }
libSearchPaths.Add(this->XCodeEscapePath(libDir)); libSearchPaths.Add(this->XCodeEscapePath(libDir));
} }
@@ -4087,16 +4085,16 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
// This is a target - get it's product path reference // This is a target - get it's product path reference
auto* xcTarget = this->FindXCodeTarget(genTarget); auto* xcTarget = this->FindXCodeTarget(genTarget);
if (!xcTarget) { if (!xcTarget) {
cmSystemTools::Error("Can not find a target for " + cmSystemTools::Error(
genTarget->GetName()); cmStrCat("Can not find a target for ", genTarget->GetName()));
continue; continue;
} }
// Add the target output file as a build reference for other targets // Add the target output file as a build reference for other targets
// to link against // to link against
auto* fileRefObject = xcTarget->GetAttribute("productReference"); auto* fileRefObject = xcTarget->GetAttribute("productReference");
if (!fileRefObject) { if (!fileRefObject) {
cmSystemTools::Error("Target " + genTarget->GetName() + cmSystemTools::Error(cmStrCat("Target ", genTarget->GetName(),
" is missing product reference"); " is missing product reference"));
continue; continue;
} }
auto it = this->FileRefToEmbedBuildFileMap.find(fileRefObject); auto it = this->FileRefToEmbedBuildFileMap.find(fileRefObject);
@@ -4121,7 +4119,8 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
this->CreateObjectReference(fileRef)); this->CreateObjectReference(fileRef));
} }
if (!buildFile) { if (!buildFile) {
cmSystemTools::Error("Can't create build file for " + relFile); cmSystemTools::Error(
cmStrCat("Can't create build file for ", relFile));
continue; continue;
} }
this->EmbeddedLibRefs.emplace(filePath, buildFile); this->EmbeddedLibRefs.emplace(filePath, buildFile);
@@ -4130,7 +4129,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
} }
} }
if (!buildFile) { if (!buildFile) {
cmSystemTools::Error("Can't find a build file for " + relFile); cmSystemTools::Error(cmStrCat("Can't find a build file for ", relFile));
continue; continue;
} }
// Set build file configuration // Set build file configuration
@@ -4689,7 +4688,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
{ {
cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile); cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile);
if (!makefileStream) { if (!makefileStream) {
cmSystemTools::Error("Could not create " + this->CurrentXCodeHackMakefile); cmSystemTools::Error(
cmStrCat("Could not create ", this->CurrentXCodeHackMakefile));
return; return;
} }
makefileStream.SetCopyIfDifferent(true); makefileStream.SetCopyIfDifferent(true);
@@ -4817,7 +4817,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
std::string xcodeDir = cmStrCat(root->GetCurrentBinaryDirectory(), '/', std::string xcodeDir = cmStrCat(root->GetCurrentBinaryDirectory(), '/',
root->GetProjectName(), ".xcodeproj"); root->GetProjectName(), ".xcodeproj");
cmSystemTools::MakeDirectory(xcodeDir); cmSystemTools::MakeDirectory(xcodeDir);
std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; std::string xcodeProjFile = cmStrCat(xcodeDir, "/project.pbxproj");
cmGeneratedFileStream fout(xcodeProjFile); cmGeneratedFileStream fout(xcodeProjFile);
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
if (!fout) { if (!fout) {
+1 -1
View File
@@ -447,7 +447,7 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
std::string const noConfig; // FIXME: What config to use here? std::string const noConfig; // FIXME: What config to use here?
xout.Attribute("BuildableName", xcObj->GetTarget()->GetFullName(noConfig)); xout.Attribute("BuildableName", xcObj->GetTarget()->GetFullName(noConfig));
xout.Attribute("BlueprintName", xcObj->GetTarget()->GetName()); xout.Attribute("BlueprintName", xcObj->GetTarget()->GetName());
xout.Attribute("ReferencedContainer", "container:" + container); xout.Attribute("ReferencedContainer", cmStrCat("container:", container));
xout.EndElement(); xout.EndElement();
} }