diff options
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 397 |
1 files changed, 200 insertions, 197 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 247d4fc..5297749 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -82,10 +82,10 @@ public: } void EndElement(const std::string& name) override { - if (name == "key") { + if (name == "key"_s) { this->Key = this->Data; - } else if (name == "string") { - if (this->Key == "CFBundleShortVersionString") { + } else if (name == "string"_s) { + if (this->Key == "CFBundleShortVersionString"_s) { this->Version = this->Data; } } @@ -105,15 +105,13 @@ public: class cmGlobalXCodeGenerator::BuildObjectListOrString { cmGlobalXCodeGenerator* Generator; - cmXCodeObject* Group; - bool Empty; + cmXCodeObject* Group = nullptr; + bool Empty = true; std::string String; public: BuildObjectListOrString(cmGlobalXCodeGenerator* gen, bool buildObjectList) : Generator(gen) - , Group(nullptr) - , Empty(true) { if (buildObjectList) { this->Group = this->Generator->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -228,7 +226,8 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name, if (commandResult) { std::string::size_type pos = out.find(".app/"); if (pos != std::string::npos) { - versionFile = out.substr(0, pos + 5) + "Contents/version.plist"; + versionFile = + cmStrCat(out.substr(0, pos + 5), "Contents/version.plist"); } } } @@ -250,7 +249,7 @@ cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name, if (version_number < 50) { cm->IssueMessage(MessageType::FATAL_ERROR, - "Xcode " + version_string + " not supported."); + cmStrCat("Xcode ", version_string, " not supported.")); return std::unique_ptr<cmGlobalGenerator>(); } @@ -390,7 +389,7 @@ bool cmGlobalXCodeGenerator::ParseGeneratorToolset(std::string const& ts, bool cmGlobalXCodeGenerator::ProcessGeneratorToolsetField( std::string const& key, std::string const& value, cmMakefile* mf) { - if (key == "buildsystem") { + if (key == "buildsystem"_s) { if (value == "1"_s) { this->XcodeBuildSystem = BuildSystem::One; } else if (value == "12"_s) { @@ -452,7 +451,7 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, bool ret = false; #ifdef HAVE_APPLICATION_SERVICES - std::string url = bindir + "/" + projectName + ".xcodeproj"; + std::string url = cmStrCat(bindir, '/', projectName, ".xcodeproj"); if (dryRun) { return cmSystemTools::FileExists(url, false); @@ -703,7 +702,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens) { std::vector<std::string> lfiles; - for (auto gen : gens) { + for (auto* gen : gens) { cm::append(lfiles, gen->GetMakefile()->GetListFiles()); } @@ -722,29 +721,30 @@ 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 " << this->ConvertToRelativeForMake(lfile) << "))\n"; } - makefileStream << "\n"; + makefileStream << '\n'; std::string checkCache = 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 " @@ -755,11 +755,11 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( makefileStream << this->ConvertToRelativeForMake(checkCache) << ": $(TARGETS)\n"; makefileStream - << "\t" << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand()) + << '\t' << this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand()) << " -S" << this->ConvertToRelativeForMake(root->GetSourceDirectory()) << " -B" << this->ConvertToRelativeForMake(root->GetBinaryDirectory()) << (cm->GetIgnoreWarningAsError() ? " --compile-no-warning-as-error" : "") - << "\n"; + << '\n'; } static bool objectIdLessThan(const std::unique_ptr<cmXCodeObject>& l, @@ -814,7 +814,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( { auto obj = cm::make_unique<cmXCode21Object>(ptype, cmXCodeObject::OBJECT, this->GetObjectId(ptype, key)); - auto ptr = obj.get(); + auto* ptr = obj.get(); this->addObject(std::move(obj)); return ptr; } @@ -824,7 +824,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) auto obj = cm::make_unique<cmXCodeObject>( cmXCodeObject::None, type, "Temporary cmake object, should not be referred to in Xcode file"); - auto ptr = obj.get(); + auto* ptr = obj.get(); this->addObject(std::move(obj)); return ptr; } @@ -854,10 +854,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig) static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) { - std::string key(target->GetName()); - key += "-"; - key += fullpath; - return key; + return cmStrCat(target->GetName(), '-', fullpath); } cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath( @@ -921,7 +918,7 @@ public: "Xcode does not support per-config per-source " << property << ":\n" " " << expression << "\n" "specified for source:\n" - " " << this->SourceFile->ResolveFullPath() << "\n"; + " " << this->SourceFile->ResolveFullPath() << '\n'; /* clang-format on */ this->LocalGenerator->IssueMessage(MessageType::FATAL_ERROR, e.str()); } @@ -945,10 +942,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); switch (cmOutputConverter::GetFortranFormat(srcfmt)) { case cmOutputConverter::FortranFormatFixed: - flags = "-fixed " + flags; + flags = cmStrCat("-fixed ", flags); break; case cmOutputConverter::FortranFormatFree: - flags = "-free " + flags; + flags = cmStrCat("-free ", flags); break; default: break; @@ -1062,30 +1059,30 @@ bool IsLinkPhaseLibraryExtension(const std::string& fileExt) { // Empty file extension is a special case for paths to framework's // internal binary which could be MyFw.framework/Versions/*/MyFw - return (fileExt == ".framework" || fileExt == ".xcframework" || - fileExt == ".a" || fileExt == ".o" || fileExt == ".dylib" || - fileExt == ".tbd" || fileExt.empty()); + return (fileExt == ".framework"_s || fileExt == ".xcframework"_s || + fileExt == ".a"_s || fileExt == ".o"_s || fileExt == ".dylib"_s || + fileExt == ".tbd"_s || fileExt.empty()); } bool IsLibraryType(const std::string& fileType) { - return (fileType == "wrapper.framework" || - fileType == "wrapper.xcframework" || fileType == "archive.ar" || - fileType == "compiled.mach-o.objfile" || - fileType == "compiled.mach-o.dylib" || - fileType == "compiled.mach-o.executable" || - fileType == "sourcecode.text-based-dylib-definition"); + return (fileType == "wrapper.framework"_s || + fileType == "wrapper.xcframework"_s || fileType == "archive.ar"_s || + fileType == "compiled.mach-o.objfile"_s || + fileType == "compiled.mach-o.dylib"_s || + fileType == "compiled.mach-o.executable"_s || + fileType == "sourcecode.text-based-dylib-definition"_s); } std::string GetDirectoryValueFromFileExtension(const std::string& dirExt) { std::string ext = cmSystemTools::LowerCase(dirExt); - if (ext == "framework") { + if (ext == "framework"_s) { return "wrapper.framework"; } - if (ext == "xcframework") { + if (ext == "xcframework"_s) { return "wrapper.xcframework"; } - if (ext == "xcassets") { + if (ext == "xcassets"_s) { return "folder.assetcatalog"; } return "folder"; @@ -1098,66 +1095,68 @@ std::string GetSourcecodeValueFromFileExtension( std::string ext = cmSystemTools::LowerCase(_ext); std::string sourcecode = "sourcecode"; - if (ext == "o") { + if (ext == "o"_s) { keepLastKnownFileType = true; sourcecode = "compiled.mach-o.objfile"; - } else if (ext == "xctest") { + } else if (ext == "xctest"_s) { sourcecode = "wrapper.cfbundle"; - } else if (ext == "xib") { + } else if (ext == "xib"_s) { keepLastKnownFileType = true; sourcecode = "file.xib"; - } else if (ext == "storyboard") { + } else if (ext == "storyboard"_s) { keepLastKnownFileType = true; sourcecode = "file.storyboard"; - } else if (ext == "mm" && !cm::contains(enabled_langs, "OBJCXX")) { + // NOLINTNEXTLINE(bugprone-branch-clone) + } else if (ext == "mm"_s && !cm::contains(enabled_langs, "OBJCXX")) { sourcecode += ".cpp.objcpp"; - } else if (ext == "m" && !cm::contains(enabled_langs, "OBJC")) { + // NOLINTNEXTLINE(bugprone-branch-clone) + } else if (ext == "m"_s && !cm::contains(enabled_langs, "OBJC")) { sourcecode += ".c.objc"; - } else if (ext == "swift") { + } else if (ext == "swift"_s) { sourcecode += ".swift"; - } else if (ext == "plist") { + } else if (ext == "plist"_s) { sourcecode += ".text.plist"; - } else if (ext == "h") { + } else if (ext == "h"_s) { sourcecode += ".c.h"; - } else if (ext == "hxx" || ext == "hpp" || ext == "txx" || ext == "pch" || - ext == "hh" || ext == "inl") { + } else if (ext == "hxx"_s || ext == "hpp"_s || ext == "txx"_s || + ext == "pch"_s || ext == "hh"_s || ext == "inl"_s) { sourcecode += ".cpp.h"; - } else if (ext == "png" || ext == "gif" || ext == "jpg") { + } else if (ext == "png"_s || ext == "gif"_s || ext == "jpg"_s) { keepLastKnownFileType = true; sourcecode = "image"; - } else if (ext == "txt") { + } else if (ext == "txt"_s) { sourcecode += ".text"; - } else if (lang == "CXX") { + } else if (lang == "CXX"_s) { sourcecode += ".cpp.cpp"; - } else if (lang == "C") { + } else if (lang == "C"_s) { sourcecode += ".c.c"; - } else if (lang == "OBJCXX") { + } else if (lang == "OBJCXX"_s) { sourcecode += ".cpp.objcpp"; - } else if (lang == "OBJC") { + } else if (lang == "OBJC"_s) { sourcecode += ".c.objc"; - } else if (lang == "Fortran") { + } else if (lang == "Fortran"_s) { sourcecode += ".fortran.f90"; - } else if (lang == "ASM") { + } else if (lang == "ASM"_s) { sourcecode += ".asm"; - } else if (ext == "metal") { + } else if (ext == "metal"_s) { sourcecode += ".metal"; - } else if (ext == "mig") { + } else if (ext == "mig"_s) { sourcecode += ".mig"; - } else if (ext == "tbd") { + } else if (ext == "tbd"_s) { sourcecode += ".text-based-dylib-definition"; - } else if (ext == "a") { + } else if (ext == "a"_s) { keepLastKnownFileType = true; sourcecode = "archive.ar"; - } else if (ext == "dylib") { + } else if (ext == "dylib"_s) { keepLastKnownFileType = true; sourcecode = "compiled.mach-o.dylib"; - } else if (ext == "framework") { + } else if (ext == "framework"_s) { keepLastKnownFileType = true; sourcecode = "wrapper.framework"; - } else if (ext == "xcassets") { + } else if (ext == "xcassets"_s) { keepLastKnownFileType = true; sourcecode = "folder.assetcatalog"; - } else if (ext == "xcconfig") { + } else if (ext == "xcconfig"_s) { keepLastKnownFileType = true; sourcecode = "text.xcconfig"; } @@ -1179,11 +1178,11 @@ std::string GetTargetObjectDirArch(T const& target, cmList archs{ target.GetSafeProperty("OSX_ARCHITECTURES") }; if (archs.size() > 1) { return "$(CURRENT_ARCH)"; - } else if (archs.size() == 1) { + } + if (archs.size() == 1) { return archs.front(); - } else { - return defaultVal; } + return defaultVal; } } // anonymous @@ -1278,7 +1277,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( this->GroupMap[key] = 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; } cmXCodeObject* children = group->GetAttribute("children"); @@ -1299,8 +1298,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReference( bool cmGlobalXCodeGenerator::SpecialTargetEmitted(std::string const& tname) { - if (tname == "ALL_BUILD" || tname == "install" || tname == "package" || - tname == "RUN_TESTS" || tname == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { + if (tname == "ALL_BUILD"_s || tname == "install"_s || tname == "package"_s || + tname == "RUN_TESTS"_s || tname == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { if (this->TargetDoneSet.find(tname) != this->TargetDoneSet.end()) { return true; } @@ -1334,10 +1333,10 @@ struct cmCompareTargets { std::string const& a = l->GetTarget()->GetName(); std::string const& b = r->GetTarget()->GetName(); - if (a == "ALL_BUILD") { + if (a == "ALL_BUILD"_s) { return true; } - if (b == "ALL_BUILD") { + if (b == "ALL_BUILD"_s) { return false; } return a < b; @@ -1350,7 +1349,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( this->SetCurrentLocalGenerator(gen); std::vector<cmGeneratorTarget*> gts = this->GetLocalGeneratorTargetsInOrder(gen); - for (auto gtgt : gts) { + for (auto* gtgt : gts) { if (!this->CreateXCodeTarget(gtgt, targets)) { return false; } @@ -1386,8 +1385,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( } auto& gtgt_visited = this->CommandsVisited[gtgt]; - auto& deps = this->GetTargetDirectDepends(gtgt); - for (auto& d : deps) { + auto const& deps = this->GetTargetDirectDepends(gtgt); + for (auto const& d : deps) { // Take the union of visited source files of custom commands so far. // ComputeTargetOrder ensures our dependencies already visited their // custom commands and updated CommandsVisited. @@ -1432,7 +1431,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( std::vector<cmXCodeObject*> headerFiles; std::vector<cmXCodeObject*> resourceFiles; std::vector<cmXCodeObject*> sourceFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); cmXCodeObject* fr = xsf->GetAttribute("fileRef"); @@ -1445,7 +1444,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); - if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { + if (filetype && filetype->GetString() == "compiled.mach-o.objfile"_s) { if (sourceFile->GetObjectLibrary().empty()) { externalObjFiles.push_back(xsf); } @@ -1535,7 +1534,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map<std::string, std::vector<cmSourceFile*>>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { @@ -1554,7 +1553,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( if (gtgt->IsFrameworkOnApple()) { // dstPath in frameworks is relative to Versions/<version> ostr << keySources.first; - } else if (keySources.first != "MacOS") { + } else if (keySources.first != "MacOS"_s) { if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; } else { @@ -1568,7 +1567,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { + for (auto* sourceFile : keySources.second) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); buildFiles->AddObject(xsf); @@ -1583,7 +1582,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( using mapOfVectorOfSourceFiles = std::map<std::string, std::vector<cmSourceFile*>>; mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : commonSourceFiles) { + for (auto* sourceFile : commonSourceFiles) { cmGeneratorTarget::SourceFileFlags tsFlags = gtgt->GetTargetSourceFileFlags(sourceFile); if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { @@ -1604,7 +1603,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget( this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { + for (auto* sourceFile : keySources.second) { cmXCodeObject* xsf = this->CreateXCodeSourceFile( this->CurrentLocalGenerator, sourceFile, gtgt); buildFiles->AddObject(xsf); @@ -1680,8 +1679,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) if (const char* productType = GetTargetProductType(gtgt)) { if (strcmp(productType, "com.apple.product-type.app-extension.messages-sticker-pack") == - 0) + 0) { return; + } } // Add an empty source file to the target that compiles with the @@ -1693,7 +1693,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) gtgt->GetName(), "-CMakeForceLinker.", cmSystemTools::LowerCase(llang)); { cmGeneratedFileStream fout(fname); - fout << "\n"; + fout << '\n'; } if (cmSourceFile* sf = mf->GetOrCreateSource(fname)) { sf->SetProperty("LANGUAGE", llang); @@ -1803,7 +1803,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( // add all the sources std::vector<cmCustomCommand> commands; auto& visited = this->CommandsVisited[gtgt]; - for (auto sourceFile : classes) { + for (auto* sourceFile : classes) { if (sourceFile->GetCustomCommand() && visited.insert(sourceFile).second) { commands.push_back(*sourceFile->GetCustomCommand()); @@ -1842,7 +1842,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (resourceBuildPhase) { buildPhases->AddObject(resourceBuildPhase); } - for (auto obj : contentBuildPhases) { + for (auto* obj : contentBuildPhases) { buildPhases->AddObject(obj); } if (sourceBuildPhase) { @@ -1871,7 +1871,7 @@ void cmGlobalXCodeGenerator::CreateRunScriptBuildPhases( return; } auto& visited = this->CommandsVisited[gt]; - for (auto sf : sources) { + for (auto* sf : sources) { this->CreateRunScriptBuildPhases(buildPhases, sf, gt, visited); } } @@ -1906,7 +1906,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( auto depfilesDirectory = cmStrCat( gt->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/CMakeFiles/d/"); - auto depfilesPrefix = cmStrCat(depfilesDirectory, buildPhase->GetId(), "."); + auto depfilesPrefix = cmStrCat(depfilesDirectory, buildPhase->GetId(), '.'); std::string shellScript = "set -e\n"; for (std::string const& configName : this->CurrentConfigurationTypes) { @@ -2076,7 +2076,7 @@ std::string cmGlobalXCodeGenerator::ConstructScript( } wd = lg->ConvertToOutputFormat(wd, cmOutputConverter::SHELL); ReplaceScriptVars(wd); - script = cmStrCat(script, " cd ", wd, "\n"); + script = cmStrCat(script, " cd ", wd, '\n'); for (unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c) { std::string cmd = ccg.GetCommand(c); if (cmd.empty()) { @@ -2201,10 +2201,10 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase( std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); cdir = this->ConvertToRelativeForMake(cdir); - std::string makecmd = - cmStrCat("make -C ", cdir, " -f ", - this->ConvertToRelativeForMake((makefile + "$CONFIGURATION")), - " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all"); + std::string makecmd = cmStrCat( + "make -C ", cdir, " -f ", + this->ConvertToRelativeForMake(cmStrCat(makefile, "$CONFIGURATION")), + " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\") all"); buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); } @@ -2219,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: "; @@ -2242,7 +2243,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } else { std::ostringstream str; str << "_buildpart_" << count++; - tname[&ccg.GetCC()] = target->GetName() + str.str(); + tname[&ccg.GetCC()] = cmStrCat(target->GetName(), str.str()); makefileStream << "\\\n\t" << tname[&ccg.GetCC()]; } } @@ -2261,7 +2262,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( return cmStrCat( depfilesDirectory, this->GetObjectId(cmXCodeObject::PBXShellScriptBuildPhase, file), - ".", config, ".d"); + '.', config, ".d"); }); auto depfile = ccg.GetInternalDepfile(); @@ -2285,7 +2286,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } if (ccg.GetNumberOfCommands() > 0) { - makefileStream << "\n"; + makefileStream << '\n'; const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { // There is at least one output, start the rule for it @@ -2302,14 +2303,14 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( for (auto const& dep : realDepends) { makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep); } - makefileStream << "\n"; + makefileStream << '\n'; if (cm::optional<std::string> comment = ccg.GetComment()) { std::string echo_cmd = cmStrCat("echo ", (this->CurrentLocalGenerator->EscapeForShell( *comment, ccg.GetCC().GetEscapeAllowMakeVars()))); - makefileStream << "\t" << echo_cmd << "\n"; + makefileStream << '\t' << echo_cmd << '\n'; } // Add each command line to the set of commands. @@ -2327,7 +2328,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( } cmd += cmd2; ccg.AppendArguments(c, cmd); - makefileStream << "\t" << cmd << "\n"; + makefileStream << '\t' << cmd << '\n'; } // Symbolic inputs are not expected to exist, so add dummy rules. @@ -2406,8 +2407,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string llang = gtgt->GetLinkerLanguage(configName); if (binary && llang.empty()) { cmSystemTools::Error( - "CMake can not determine linker language for target: " + - gtgt->GetName()); + cmStrCat("CMake can not determine linker language for target: ", + gtgt->GetName())); return; } @@ -2471,7 +2472,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::set<std::string> defines(targetSwiftDefines.begin(), targetSwiftDefines.end()); this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift"); - cflags["Swift"] += " " + defineString; + cflags["Swift"] += cmStrCat(' ', defineString); } else { BuildObjectListOrString swiftDefs(this, true); this->AppendDefines(swiftDefs, targetSwiftDefines); @@ -2558,9 +2559,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string realName = components.base; std::string soName = components.base; if (version && soversion) { - realName += "."; + realName += '.'; realName += *version; - soName += "."; + soName += '.'; soName += *soversion; } @@ -2645,7 +2646,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags( "CMAKE_SHARED_MODULE_CREATE_", llang, "_FLAGS", "-bundle"); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } cmValue ext = gtgt->GetProperty("BUNDLE_EXTENSION"); @@ -2671,7 +2672,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } } @@ -2701,7 +2702,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags( "CMAKE_SHARED_LIBRARY_CREATE_", llang, "_FLAGS", "-dynamiclib"); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } } @@ -2721,7 +2722,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } @@ -2830,7 +2831,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, includes, gtgt, language, configName); if (!includeFlags.empty()) { - cflags[language] += " " + includeFlags; + cflags[language] += cmStrCat(' ', includeFlags); } } } @@ -2854,8 +2855,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, gflag = this->ExtractFlag("-g", flags); // put back gdwarf-2 if used since there is no way // to represent it in the gui, but we still want debug yes - if (gflag == "-gdwarf-2") { - flags += " "; + if (gflag == "-gdwarf-2"_s) { + flags += ' '; flags += gflag; } if (last_gflag && *last_gflag != gflag) { @@ -2869,17 +2870,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // We can't set the Xcode flag differently depending on the language, // so put them back in this case. for (auto const& language : languages) { - cflags[language] += " "; + cflags[language] += ' '; cflags[language] += gflags[language]; } debugStr = "NO"; - } else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) { + } else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0"_s)) { debugStr = "NO"; } // extract C++ stdlib for (auto const& language : languages) { - if (language != "CXX" && language != "OBJCXX") { + if (language != "CXX"_s && language != "OBJCXX"_s) { continue; } std::string& flags = cflags[language]; @@ -2888,7 +2889,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags); if (stdlib.size() > 8) { const auto cxxLibrary = stdlib.substr(8); - if (language == "CXX" || + if (language == "CXX"_s || !buildSettings->GetAttribute("CLANG_CXX_LIBRARY")) { buildSettings->AddAttribute("CLANG_CXX_LIBRARY", this->CreateString(cxxLibrary)); @@ -2908,21 +2909,21 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("NO")); for (auto const& language : languages) { - std::string flags = cflags[language] + " " + defFlags; - if (language == "CXX" || language == "OBJCXX") { - if (language == "CXX" || + std::string flags = cmStrCat(cflags[language], ' ', defFlags); + if (language == "CXX"_s || language == "OBJCXX"_s) { + if (language == "CXX"_s || !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS", this->CreateString(flags)); } - } else if (language == "Fortran") { + } else if (language == "Fortran"_s) { buildSettings->AddAttribute("IFORT_OTHER_FLAGS", this->CreateString(flags)); - } else if (language == "C" || language == "OBJC") { - if (language == "C" || !buildSettings->GetAttribute("OTHER_CFLAGS")) { + } else if (language == "C"_s || language == "OBJC"_s) { + if (language == "C"_s || !buildSettings->GetAttribute("OTHER_CFLAGS")) { buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags)); } - } else if (language == "Swift") { + } else if (language == "Swift"_s) { buildSettings->AddAttribute("OTHER_SWIFT_FLAGS", this->CreateString(flags)); } @@ -2961,7 +2962,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Convert to a path for the native build tool. cmSystemTools::ConvertToUnixSlashes(install_name_dir); install_name += install_name_dir; - install_name += "/"; + install_name += '/'; } install_name += gtgt->GetSOName(configName); @@ -2989,7 +2990,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (unique_dirs.find(runpath) == unique_dirs.end()) { unique_dirs.insert(runpath); if (!search_paths.empty()) { - search_paths += " "; + search_paths += ' '; } search_paths += this->XCodeEscapePath(runpath); } @@ -3024,7 +3025,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Xcode always wants at least 1.0.0 or nothing if (!(major == 0 && minor == 0 && patch == 0)) { - v << major << "." << minor << "." << patch; + v << major << '.' << minor << '.' << patch; } buildSettings->AddAttribute("DYLIB_CURRENT_VERSION", this->CreateString(v.str())); @@ -3036,7 +3037,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Xcode always wants at least 1.0.0 or nothing if (!(major == 0 && minor == 0 && patch == 0)) { - vso << major << "." << minor << "." << patch; + vso << major << '.' << minor << '.' << patch; } buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION", this->CreateString(vso.str())); @@ -3117,7 +3118,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( // Add CMakeLists.txt file for user convenience. this->AddXCodeProjBuildRule(gtgt, sources); - for (auto sourceFile : sources) { + for (auto* sourceFile : sources) { if (!sourceFile->GetIsGenerated()) { this->CreateXCodeFileReference(sourceFile, gtgt); } @@ -3178,11 +3179,11 @@ void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings( return; } - auto sf = this->CurrentMakefile->GetSource(xcconfig); + auto* sf = this->CurrentMakefile->GetSource(xcconfig); if (!sf) { cmSystemTools::Error( cmStrCat("sources for ALL_BUILD do not contain xcconfig file: '", - xcconfig, "' (configuration: ", configName, ")")); + xcconfig, "' (configuration: ", configName, ')')); return; } @@ -3210,12 +3211,12 @@ void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings( return; } - auto sf = target->Makefile->GetSource(xcconfig); + auto* sf = target->Makefile->GetSource(xcconfig); if (!sf) { cmSystemTools::Error(cmStrCat("target sources for target ", target->Target->GetName(), " do not contain xcconfig file: '", xcconfig, - "' (configuration: ", configName, ")")); + "' (configuration: ", configName, ')')); return; } @@ -3458,8 +3459,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( { if (value->GetType() != cmXCodeObject::OBJECT_LIST && value->GetType() != cmXCodeObject::STRING) { - cmSystemTools::Error("Unsupported value type for appending: " + - std::string(attribute)); + cmSystemTools::Error( + cmStrCat("Unsupported value type for appending: ", attribute)); return; } if (attr->GetType() == cmXCodeObject::OBJECT_LIST) { @@ -3482,8 +3483,8 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( attr->SetString(newValue); } } else { - cmSystemTools::Error("Unsupported attribute type for appending: " + - std::string(attribute)); + cmSystemTools::Error( + cmStrCat("Unsupported attribute type for appending: ", attribute)); } } @@ -3497,7 +3498,7 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute( target->GetAttribute("buildConfigurationList")->GetObject(); cmXCodeObject* buildConfigs = configurationList->GetAttribute("buildConfigurations"); - for (auto obj : buildConfigs->GetObjectList()) { + for (auto* obj : buildConfigs->GetObjectList()) { if (configName.empty() || obj->GetAttribute("name")->GetString() == configName) { cmXCodeObject* settings = obj->GetAttribute("buildSettings"); @@ -3513,7 +3514,7 @@ void cmGlobalXCodeGenerator::InheritBuildSettingAttribute( target->GetAttribute("buildConfigurationList")->GetObject(); cmXCodeObject* buildConfigs = configurationList->GetAttribute("buildConfigurations"); - for (auto obj : buildConfigs->GetObjectList()) { + for (auto* obj : buildConfigs->GetObjectList()) { cmXCodeObject* settings = obj->GetAttribute("buildSettings"); if (cmXCodeObject* attr = settings->GetAttribute(attribute)) { BuildObjectListOrString inherited(this, true); @@ -3574,14 +3575,14 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) cmValue prop = target->GetTarget()->GetProperty("XCODE_LINK_BUILD_PHASE_MODE"); if (prop) { - if (*prop == "BUILT_ONLY") { + if (*prop == "BUILT_ONLY"_s) { useLinkPhase = true; - } else if (*prop == "KNOWN_LOCATION") { + } else if (*prop == "KNOWN_LOCATION"_s) { useLinkPhase = true; forceLinkPhase = true; - } else if (*prop != "NONE") { - cmSystemTools::Error("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: " + - *prop); + } else if (*prop != "NONE"_s) { + cmSystemTools::Error( + cmStrCat("Invalid value for XCODE_LINK_BUILD_PHASE_MODE: ", *prop)); return; } } @@ -3835,7 +3836,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) BuildObjectListOrString libSearchPaths(this, true); std::vector<cmSourceFile const*> objs; gt->GetExternalObjects(objs, configName); - for (auto sourceFile : objs) { + for (auto const* sourceFile : objs) { if (sourceFile->GetObjectLibrary().empty()) { continue; } @@ -3869,12 +3870,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) std::string linkDirs; for (auto const& libDir : cli->GetDirectories()) { - if (!libDir.empty() && libDir != "/usr/lib") { + if (!libDir.empty() && libDir != "/usr/lib"_s) { cmPolicies::PolicyStatus cmp0142 = target->GetTarget()->GetPolicyStatusCMP0142(); if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) { - libSearchPaths.Add(this->XCodeEscapePath( - libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)")); + libSearchPaths.Add(this->XCodeEscapePath(cmStrCat( + libDir, "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"))); } libSearchPaths.Add(this->XCodeEscapePath(libDir)); } @@ -4086,16 +4087,16 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( // This is a target - get it's product path reference auto* xcTarget = this->FindXCodeTarget(genTarget); if (!xcTarget) { - cmSystemTools::Error("Can not find a target for " + - genTarget->GetName()); + cmSystemTools::Error( + cmStrCat("Can not find a target for ", genTarget->GetName())); continue; } // Add the target output file as a build reference for other targets // to link against auto* fileRefObject = xcTarget->GetAttribute("productReference"); if (!fileRefObject) { - cmSystemTools::Error("Target " + genTarget->GetName() + - " is missing product reference"); + cmSystemTools::Error(cmStrCat("Target ", genTarget->GetName(), + " is missing product reference")); continue; } auto it = this->FileRefToEmbedBuildFileMap.find(fileRefObject); @@ -4120,7 +4121,8 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( this->CreateObjectReference(fileRef)); } if (!buildFile) { - cmSystemTools::Error("Can't create build file for " + relFile); + cmSystemTools::Error( + cmStrCat("Can't create build file for ", relFile)); continue; } this->EmbeddedLibRefs.emplace(filePath, buildFile); @@ -4129,7 +4131,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( } } if (!buildFile) { - cmSystemTools::Error("Can't find a build file for " + relFile); + cmSystemTools::Error(cmStrCat("Can't find a build file for ", relFile)); continue; } // Set build file configuration @@ -4171,7 +4173,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects( void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "10"; + static auto const* const dstSubfolderSpec = "10"; // Despite the name, by default Xcode uses "Embed Frameworks" build phase // for both frameworks and dynamic libraries @@ -4182,7 +4184,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedFrameworks(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "13"; + static auto const* const dstSubfolderSpec = "13"; this->AddEmbeddedObjects(target, "Embed PlugIns", "XCODE_EMBED_PLUGINS", dstSubfolderSpec, NoActionOnCopyByDefault); @@ -4190,7 +4192,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedPlugIns(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target) { - static const auto dstSubfolderSpec = "13"; + static auto const* const dstSubfolderSpec = "13"; this->AddEmbeddedObjects(target, "Embed App Extensions", "XCODE_EMBED_APP_EXTENSIONS", dstSubfolderSpec, @@ -4200,7 +4202,7 @@ void cmGlobalXCodeGenerator::AddEmbeddedAppExtensions(cmXCodeObject* target) void cmGlobalXCodeGenerator::AddEmbeddedExtensionKitExtensions( cmXCodeObject* target) { - static const auto dstSubfolderSpec = "16"; + static auto const* const dstSubfolderSpec = "16"; this->AddEmbeddedObjects(target, "Embed App Extensions", "XCODE_EMBED_EXTENSIONKIT_EXTENSIONS", @@ -4311,7 +4313,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( for (std::vector<std::string>::size_type i = 0; i < tgt_folders.size(); i++) { if (i != 0) { - curr_tgt_folder += "/"; + curr_tgt_folder += '/'; } curr_tgt_folder += tgt_folders[i]; it = this->TargetGroup.find(curr_tgt_folder); @@ -4350,7 +4352,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( } else { tgroup = i_folder->second; } - curr_folder += "\\"; + curr_folder += '\\'; } return tgroup; } @@ -4594,7 +4596,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->CustomCommandRoots.clear(); } // loop over all targets and add link and depend info - for (auto t : targets) { + for (auto* t : targets) { this->AddDependAndLinkInformation(t); this->AddEmbeddedFrameworks(t); this->AddEmbeddedPlugIns(t); @@ -4620,7 +4622,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( } // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto t : targets) { + for (auto* t : targets) { allTargets->AddObject(t); cmXCodeObject* productRef = t->GetAttribute("productReference"); if (productRef) { @@ -4688,16 +4690,17 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( { cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile); if (!makefileStream) { - cmSystemTools::Error("Could not create " + this->CurrentXCodeHackMakefile); + cmSystemTools::Error( + cmStrCat("Could not create ", this->CurrentXCodeHackMakefile)); return; } makefileStream.SetCopyIfDifferent(true); // 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"; @@ -4713,7 +4716,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( "# does not seem to check these dependencies itself.\n"; /* clang-format on */ for (const auto& configName : this->CurrentConfigurationTypes) { - for (auto target : targets) { + for (auto* target : targets) { cmGeneratorTarget* gt = target->GetTarget(); if (gt->GetType() == cmStateEnums::EXECUTABLE || @@ -4738,20 +4741,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( if (y != target->GetDependTargets().end()) { for (auto const& deptgt : y->second) { makefileStream << this->PostBuildMakeTarget(deptgt, configName) - << ": " << trel << "\n"; + << ": " << trel << '\n'; } } std::vector<cmGeneratorTarget*> objlibs; gt->GetObjectLibrariesCMP0026(objlibs); - for (auto objLib : objlibs) { + for (auto* objLib : objlibs) { makefileStream << this->PostBuildMakeTarget(objLib->GetName(), configName) - << ": " << trel << "\n"; + << ": " << trel << '\n'; } // Create a rule for this target. - makefileStream << trel << ":"; + makefileStream << trel << ':'; // List dependencies if any exist. auto const x = target->GetDependLibraries().find(configName); @@ -4763,7 +4766,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } } - for (auto objLib : objlibs) { + for (auto* objLib : objlibs) { const std::string objLibName = objLib->GetName(); std::string d = cmStrCat(this->GetTargetTempDir(gt, configName), @@ -4775,9 +4778,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( } // Write the action to remove the target if it is out of date. - makefileStream << "\n"; - makefileStream << "\t/bin/rm -f " - << this->ConvertToRelativeForMake(tfull) << "\n"; + makefileStream << "\n" + "\t/bin/rm -f " + << this->ConvertToRelativeForMake(tfull) << '\n'; // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { @@ -4788,7 +4791,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( gt->GetFullName(configName)); makefileStream << "\t/bin/rm -f " << this->ConvertToRelativeForMake(universalFile) - << "\n"; + << '\n'; } } makefileStream << "\n\n"; @@ -4797,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"; } @@ -4816,7 +4819,7 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( std::string xcodeDir = cmStrCat(root->GetCurrentBinaryDirectory(), '/', root->GetProjectName(), ".xcodeproj"); cmSystemTools::MakeDirectory(xcodeDir); - std::string xcodeProjFile = xcodeDir + "/project.pbxproj"; + std::string xcodeProjFile = cmStrCat(xcodeDir, "/project.pbxproj"); cmGeneratedFileStream fout(xcodeProjFile); fout.SetCopyIfDifferent(true); if (!fout) { @@ -4941,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); @@ -4954,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 @@ -5094,7 +5097,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // Separate from previous flags. if (!flags.empty()) { - flags += " "; + flags += ' '; } // Check if the flag needs quoting. @@ -5113,7 +5116,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Open single quote. - flags += "'"; + flags += '\''; } // Flag value with escaped quotes and backslashes. @@ -5129,7 +5132,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Close single quote. - flags += "'"; + flags += '\''; } } |