diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-07-27 13:10:04 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-07-30 22:33:07 (GMT) |
commit | 09b7ac7f6781fcf665cadf08a19a274bfc8c3521 (patch) | |
tree | ee8d7d77d414ddd4e651791d742bb4917331fbfe | |
parent | 6aa90237006f1c4556e0cd18ae0e493650e7515c (diff) | |
download | CMake-09b7ac7f6781fcf665cadf08a19a274bfc8c3521.zip CMake-09b7ac7f6781fcf665cadf08a19a274bfc8c3521.tar.gz CMake-09b7ac7f6781fcf665cadf08a19a274bfc8c3521.tar.bz2 |
strings: use single characters where possible
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 24 | ||||
-rw-r--r-- | Source/CPack/cmCPackPKGGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackProductBuildGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 82 |
4 files changed, 59 insertions, 59 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index c7b8bfe..b4cada3 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -140,9 +140,9 @@ int cmCPackDragNDropGenerator::InitializeInternal() } for (auto const& language : languages) { std::string license = - cmStrCat(slaDirectory, "/", language, ".license.txt"); + cmStrCat(slaDirectory, '/', language, ".license.txt"); std::string license_rtf = - cmStrCat(slaDirectory, "/", language, ".license.rtf"); + cmStrCat(slaDirectory, '/', language, ".license.rtf"); if (!singleLicense) { if (!cmSystemTools::FileExists(license) && !cmSystemTools::FileExists(license_rtf)) { @@ -153,7 +153,7 @@ int cmCPackDragNDropGenerator::InitializeInternal() return 0; } } - std::string menu = cmStrCat(slaDirectory, "/", language, ".menu.txt"); + std::string menu = cmStrCat(slaDirectory, '/', language, ".menu.txt"); if (!cmSystemTools::FileExists(menu)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Missing menu file " << language << ".menu.txt" @@ -197,7 +197,7 @@ int cmCPackDragNDropGenerator::PackageFiles() // loop to create dmg files packageFileNames.clear(); for (auto const& package_file : package_files) { - std::string full_package_name = cmStrCat(toplevel, "/"); + std::string full_package_name = cmStrCat(toplevel, '/'); if (package_file == "ALL_IN_ONE"_s) { full_package_name += this->GetOption("CPACK_PACKAGE_FILE_NAME"); } else { @@ -429,7 +429,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cpack_dmg_filesystem, "\"" " -format ", - temp_image_format, " \"", temp_image, "\""); + temp_image_format, " \"", temp_image, '"'); if (!this->RunCommand(temp_image_command, &create_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -448,7 +448,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, auto attach_command = cmStrCat(this->GetOption("CPACK_COMMAND_HDIUTIL"), " attach" " \"", - temp_image, "\""); + temp_image, '"'); std::string attach_output; if (!this->RunCommand(attach_command, &attach_output)) { @@ -480,7 +480,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, auto setfile_command = cmStrCat(this->GetOption("CPACK_COMMAND_SETFILE"), " -a C" " \"", - temp_mount, "\""); + temp_mount, '"'); if (!this->RunCommand(setfile_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -500,7 +500,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cpack_dmg_ds_store_setup_script, "\"" " \"", - temp_mount_name, "\""); + temp_mount_name, '"'); std::string error; if (!this->RunCommand(setup_script_command, &error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -538,7 +538,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, " -imagekey" " zlib-level=9" " -o \"", - output_file, "\""); + output_file, '"'); std::string convert_error; @@ -687,7 +687,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, "\"" " FIXME_WHY_IS_THIS_ARGUMENT_NEEDED" " \"", - output_file, "\""); + output_file, '"'); std::string embed_error; if (!this->RunCommand(embed_sla_command, &embed_error)) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -824,7 +824,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, actual_license = licenseFile; } else { std::string license_wo_ext = - cmStrCat(slaDirectory, "/", licenseLanguage, ".license"); + cmStrCat(slaDirectory, '/', licenseLanguage, ".license"); if (cmSystemTools::FileExists(cmStrCat(license_wo_ext, ".txt"))) { actual_license = cmStrCat(license_wo_ext, ".txt"); } else { @@ -852,7 +852,7 @@ bool cmCPackDragNDropGenerator::WriteLicense(RezDoc& rez, size_t licenseNumber, } else { std::vector<std::string> lines; std::string actual_menu = - cmStrCat(slaDirectory, "/", licenseLanguage, ".menu.txt"); + cmStrCat(slaDirectory, '/', licenseLanguage, ".menu.txt"); if (!this->ReadFile(actual_menu, lines, error)) { return false; } diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 13135f5..4d60c6c 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -41,7 +41,7 @@ std::string cmCPackPKGGenerator::GetPackageName( std::string packagesDir = cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy"); return cmStrCat( - cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), "-", + cmSystemTools::GetFilenameWithoutLastExtension(packagesDir), '-', component.Name, ".pkg"); } diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index fd3c659..ae3c50e 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -119,7 +119,7 @@ int cmCPackProductBuildGenerator::PackageFiles() << (keychainPath.empty() ? std::string{} : cmStrCat(" --keychain \"", keychainPath, '"')) - << " \"" << packageFileNames[0] << "\""; + << " \"" << packageFileNames[0] << '"'; // Run ProductBuild return RunProductBuild(pkgCmd.str()); @@ -193,7 +193,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( std::string resDir = packageFileDir; if (component) { - resDir += "/"; + resDir += '/'; resDir += component->Name; } std::string scriptDir = cmStrCat(resDir, "/scripts"); @@ -258,7 +258,7 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( << (keychainPath.empty() ? std::string{} : cmStrCat(" --keychain \"", keychainPath, "\"")) - << " \"" << packageFile << "\""; + << " \"" << packageFile << '"'; if (component && !component->Plist.empty()) { pkgCmd << " --component-plist \"" << component->Plist << "\""; @@ -271,10 +271,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage( cmValue cmCPackProductBuildGenerator::GetComponentScript( const char* script, const char* component_name) { - std::string scriptname = cmStrCat("CPACK_", script, "_"); + std::string scriptname = cmStrCat("CPACK_", script, '_'); if (component_name) { scriptname += cmSystemTools::UpperCase(component_name); - scriptname += "_"; + scriptname += '_'; } scriptname += "SCRIPT"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3b19808..5297749 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -451,7 +451,7 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, bool ret = false; #ifdef HAVE_APPLICATION_SERVICES - std::string url = cmStrCat(bindir, "/", projectName, ".xcodeproj"); + std::string url = cmStrCat(bindir, '/', projectName, ".xcodeproj"); if (dryRun) { return cmSystemTools::FileExists(url, false); @@ -732,7 +732,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard " << this->ConvertToRelativeForMake(lfile) << "))\n"; } - makefileStream << "\n"; + makefileStream << '\n'; std::string checkCache = cmStrCat(root->GetBinaryDirectory(), "/CMakeFiles/cmake.check_cache"); @@ -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, @@ -854,7 +854,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateFlatClone(cmXCodeObject* orig) static std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) { - return cmStrCat(target->GetName(), "-", fullpath); + return cmStrCat(target->GetName(), '-', fullpath); } cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeBuildFileFromPath( @@ -918,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()); } @@ -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); @@ -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()) { @@ -2262,7 +2262,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( return cmStrCat( depfilesDirectory, this->GetObjectId(cmXCodeObject::PBXShellScriptBuildPhase, file), - ".", config, ".d"); + '.', config, ".d"); }); auto depfile = ccg.GetInternalDepfile(); @@ -2286,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 @@ -2303,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. @@ -2328,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. @@ -2472,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"] += cmStrCat(" ", defineString); + cflags["Swift"] += cmStrCat(' ', defineString); } else { BuildObjectListOrString swiftDefs(this, true); this->AppendDefines(swiftDefs, targetSwiftDefines); @@ -2559,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; } @@ -2646,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"); @@ -2672,7 +2672,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } } @@ -2702,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; } } @@ -2722,7 +2722,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); if (!createFlags.empty()) { - extraLinkOptions += " "; + extraLinkOptions += ' '; extraLinkOptions += createFlags; } @@ -2831,7 +2831,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, includes, gtgt, language, configName); if (!includeFlags.empty()) { - cflags[language] += cmStrCat(" ", includeFlags); + cflags[language] += cmStrCat(' ', includeFlags); } } } @@ -2856,7 +2856,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // 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"_s) { - flags += " "; + flags += ' '; flags += gflag; } if (last_gflag && *last_gflag != gflag) { @@ -2870,7 +2870,7 @@ 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"; @@ -2909,7 +2909,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("NO")); for (auto const& language : languages) { - std::string flags = cmStrCat(cflags[language], " ", defFlags); + std::string flags = cmStrCat(cflags[language], ' ', defFlags); if (language == "CXX"_s || language == "OBJCXX"_s) { if (language == "CXX"_s || !buildSettings->GetAttribute("OTHER_CPLUSPLUSFLAGS")) { @@ -2962,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); @@ -2990,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); } @@ -3025,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())); @@ -3037,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())); @@ -3183,7 +3183,7 @@ void cmGlobalXCodeGenerator::CreateGlobalXCConfigSettings( if (!sf) { cmSystemTools::Error( cmStrCat("sources for ALL_BUILD do not contain xcconfig file: '", - xcconfig, "' (configuration: ", configName, ")")); + xcconfig, "' (configuration: ", configName, ')')); return; } @@ -3216,7 +3216,7 @@ void cmGlobalXCodeGenerator::CreateTargetXCConfigSettings( cmSystemTools::Error(cmStrCat("target sources for target ", target->Target->GetName(), " do not contain xcconfig file: '", xcconfig, - "' (configuration: ", configName, ")")); + "' (configuration: ", configName, ')')); return; } @@ -4313,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); @@ -4352,7 +4352,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup( } else { tgroup = i_folder->second; } - curr_folder += "\\"; + curr_folder += '\\'; } return tgroup; } @@ -4741,7 +4741,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( if (y != target->GetDependTargets().end()) { for (auto const& deptgt : y->second) { makefileStream << this->PostBuildMakeTarget(deptgt, configName) - << ": " << trel << "\n"; + << ": " << trel << '\n'; } } @@ -4750,11 +4750,11 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( 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); @@ -4780,7 +4780,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( // Write the action to remove the target if it is out of date. makefileStream << "\n" "\t/bin/rm -f " - << this->ConvertToRelativeForMake(tfull) << "\n"; + << this->ConvertToRelativeForMake(tfull) << '\n'; // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { @@ -4791,7 +4791,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile( gt->GetFullName(configName)); makefileStream << "\t/bin/rm -f " << this->ConvertToRelativeForMake(universalFile) - << "\n"; + << '\n'; } } makefileStream << "\n\n"; @@ -5097,7 +5097,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, // Separate from previous flags. if (!flags.empty()) { - flags += " "; + flags += ' '; } // Check if the flag needs quoting. @@ -5116,7 +5116,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Open single quote. - flags += "'"; + flags += '\''; } // Flag value with escaped quotes and backslashes. @@ -5132,7 +5132,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, if (quoteFlag) { // Close single quote. - flags += "'"; + flags += '\''; } } |