mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 06:47:08 -05:00
Merge topic 'CMake-uses-cmList-class'
241304190fCMake code rely on cmList class for CMake lists management (part. 2)87fe031a07cmList class: various enhancements Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8441
This commit is contained in:
@@ -80,15 +80,15 @@ void cmCPackIFWCommon::ExpandListArgument(
|
||||
return;
|
||||
}
|
||||
|
||||
cmList::index_type i = 0;
|
||||
std::size_t c = args.size();
|
||||
cmList::size_type i = 0;
|
||||
auto c = args.size();
|
||||
if (c % 2) {
|
||||
argsOut[""] = args[i];
|
||||
++i;
|
||||
}
|
||||
|
||||
--c;
|
||||
for (; i < static_cast<cmList::index_type>(c); i += 2) {
|
||||
for (; i < c; i += 2) {
|
||||
argsOut[args[i]] = args[i + 1];
|
||||
}
|
||||
}
|
||||
@@ -101,15 +101,15 @@ void cmCPackIFWCommon::ExpandListArgument(
|
||||
return;
|
||||
}
|
||||
|
||||
cmList::index_type i = 0;
|
||||
std::size_t c = args.size();
|
||||
cmList::size_type i = 0;
|
||||
auto c = args.size();
|
||||
if (c % 2) {
|
||||
argsOut.insert(std::pair<std::string, std::string>("", args[i]));
|
||||
++i;
|
||||
}
|
||||
|
||||
--c;
|
||||
for (; i < static_cast<cmList::index_type>(c); i += 2) {
|
||||
for (; i < c; i += 2) {
|
||||
argsOut.insert(std::pair<std::string, std::string>(args[i], args[i + 1]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "cmCPackIFWRepository.h"
|
||||
#include "cmCPackLog.h" // IWYU pragma: keep
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmList.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
@@ -428,16 +428,16 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
|
||||
}
|
||||
|
||||
// QtIFW dependencies
|
||||
std::vector<std::string> deps;
|
||||
cmList deps;
|
||||
option = prefix + "DEPENDS";
|
||||
if (cmValue value = this->GetOption(option)) {
|
||||
cmExpandList(value, deps);
|
||||
deps.assign(value);
|
||||
}
|
||||
option = prefix + "DEPENDENCIES";
|
||||
if (cmValue value = this->GetOption(option)) {
|
||||
cmExpandList(value, deps);
|
||||
deps.append(value);
|
||||
}
|
||||
for (std::string const& d : deps) {
|
||||
for (auto const& d : deps) {
|
||||
DependenceStruct dep(d);
|
||||
if (this->Generator->Packages.count(dep.Name)) {
|
||||
cmCPackIFWPackage& depPkg = this->Generator->Packages[dep.Name];
|
||||
|
||||
@@ -681,10 +681,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
|
||||
featureDefinitions.BeginElement("FeatureRef");
|
||||
featureDefinitions.AddAttribute("Id", featureId);
|
||||
|
||||
std::vector<std::string> cpackPackageExecutablesList;
|
||||
cmList cpackPackageExecutablesList;
|
||||
cmValue cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
|
||||
if (cpackPackageExecutables) {
|
||||
cmExpandList(cpackPackageExecutables, cpackPackageExecutablesList);
|
||||
cpackPackageExecutablesList.assign(cpackPackageExecutables);
|
||||
if (cpackPackageExecutablesList.size() % 2 != 0) {
|
||||
cmCPackLogger(
|
||||
cmCPackLog::LOG_ERROR,
|
||||
@@ -695,10 +695,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> cpackPackageDesktopLinksList;
|
||||
cmList cpackPackageDesktopLinksList;
|
||||
cmValue cpackPackageDesktopLinks = GetOption("CPACK_CREATE_DESKTOP_LINKS");
|
||||
if (cpackPackageDesktopLinks) {
|
||||
cmExpandList(cpackPackageDesktopLinks, cpackPackageDesktopLinksList);
|
||||
cpackPackageDesktopLinksList.assign(cpackPackageDesktopLinks);
|
||||
}
|
||||
|
||||
AddDirectoryAndFileDefinitions(
|
||||
|
||||
@@ -19,10 +19,9 @@ cmWIXAccessControlList::cmWIXAccessControlList(
|
||||
|
||||
bool cmWIXAccessControlList::Apply()
|
||||
{
|
||||
std::vector<std::string> entries;
|
||||
this->InstalledFile.GetPropertyAsList("CPACK_WIX_ACL", entries);
|
||||
auto entries = this->InstalledFile.GetPropertyAsList("CPACK_WIX_ACL");
|
||||
|
||||
for (std::string const& entry : entries) {
|
||||
for (auto const& entry : entries) {
|
||||
this->CreatePermissionElement(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,10 +91,9 @@ void cmWIXShortcuts::CreateFromProperty(std::string const& propertyName,
|
||||
std::string const& directoryId,
|
||||
cmInstalledFile const& installedFile)
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
installedFile.GetPropertyAsList(propertyName, list);
|
||||
auto list = installedFile.GetPropertyAsList(propertyName);
|
||||
|
||||
for (std::string const& label : list) {
|
||||
for (auto const& label : list) {
|
||||
cmWIXShortcut shortcut;
|
||||
shortcut.label = label;
|
||||
shortcut.workingDirectoryId = directoryId;
|
||||
|
||||
@@ -543,9 +543,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
|
||||
std::string sla_xml =
|
||||
cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/sla.xml");
|
||||
|
||||
std::vector<std::string> languages;
|
||||
cmList languages;
|
||||
if (!oldStyle) {
|
||||
cmExpandList(cpack_dmg_languages, languages);
|
||||
languages.assign(cpack_dmg_languages);
|
||||
}
|
||||
|
||||
std::vector<uint16_t> header_data;
|
||||
@@ -574,7 +574,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
|
||||
|
||||
header_data.push_back(0);
|
||||
header_data.push_back(languages.size());
|
||||
for (size_t i = 0; i < languages.size(); ++i) {
|
||||
for (cmList::size_type i = 0; i < languages.size(); ++i) {
|
||||
CFStringRef language_cfstring = CFStringCreateWithCString(
|
||||
nullptr, languages[i].c_str(), kCFStringEncodingUTF8);
|
||||
CFStringRef iso_language =
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
#include "cmCPackComponentGroup.h"
|
||||
#include "cmCPackLog.h"
|
||||
#include "cmList.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmValue.h"
|
||||
|
||||
@@ -79,7 +79,7 @@ int cmCPackExternalGenerator::PackageFiles()
|
||||
|
||||
cmValue builtPackages = this->GetOption("CPACK_EXTERNAL_BUILT_PACKAGES");
|
||||
if (builtPackages) {
|
||||
cmExpandList(builtPackages, this->packageFileNames, false);
|
||||
cmExpandList(builtPackages, this->packageFileNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -573,7 +573,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
++it;
|
||||
project.SubDirectory = *it;
|
||||
|
||||
std::vector<std::string> componentsVector;
|
||||
cmList componentsList;
|
||||
|
||||
bool componentInstall = false;
|
||||
/*
|
||||
@@ -588,7 +588,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
std::string installTypesVar = "CPACK_" +
|
||||
cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
|
||||
cmValue installTypes = this->GetOption(installTypesVar);
|
||||
if (cmNonempty(installTypes)) {
|
||||
if (!installTypes.IsEmpty()) {
|
||||
cmList installTypesList{ installTypes };
|
||||
for (std::string const& installType : installTypesList) {
|
||||
project.InstallationTypes.push_back(
|
||||
@@ -600,23 +600,23 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
std::string componentsVar =
|
||||
"CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
|
||||
cmValue components = this->GetOption(componentsVar);
|
||||
if (cmNonempty(components)) {
|
||||
cmExpandList(components, componentsVector);
|
||||
for (std::string const& comp : componentsVector) {
|
||||
if (!components.IsEmpty()) {
|
||||
componentsList.assign(components);
|
||||
for (auto const& comp : componentsList) {
|
||||
project.Components.push_back(
|
||||
this->GetComponent(project.ProjectName, comp));
|
||||
}
|
||||
componentInstall = true;
|
||||
}
|
||||
}
|
||||
if (componentsVector.empty()) {
|
||||
componentsVector.push_back(project.Component);
|
||||
if (componentsList.empty()) {
|
||||
componentsList.push_back(project.Component);
|
||||
}
|
||||
|
||||
std::vector<std::string> buildConfigs;
|
||||
cmList buildConfigs;
|
||||
|
||||
// Try get configuration names given via `-C` CLI option
|
||||
cmExpandList(this->GetOption("CPACK_BUILD_CONFIG"), buildConfigs);
|
||||
buildConfigs.assign(this->GetOption("CPACK_BUILD_CONFIG"));
|
||||
|
||||
// Remove duplicates
|
||||
std::sort(buildConfigs.begin(), buildConfigs.end());
|
||||
@@ -655,7 +655,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
<< buildConfig << ']'
|
||||
<< std::endl);
|
||||
// Run the installation for each component
|
||||
for (std::string const& component : componentsVector) {
|
||||
for (std::string const& component : componentsList) {
|
||||
if (!this->InstallCMakeProject(
|
||||
setDestDir, project.Directory, baseTempInstallDirectory,
|
||||
default_dir_mode, component, componentInstall,
|
||||
@@ -888,9 +888,8 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
|
||||
}
|
||||
|
||||
std::vector<std::string> custom_variables;
|
||||
this->MakefileMap->GetDefExpandList("CPACK_CUSTOM_INSTALL_VARIABLES",
|
||||
custom_variables);
|
||||
cmList custom_variables{ this->MakefileMap->GetDefinition(
|
||||
"CPACK_CUSTOM_INSTALL_VARIABLES") };
|
||||
|
||||
for (auto const& custom_variable : custom_variables) {
|
||||
std::string value;
|
||||
|
||||
@@ -246,8 +246,7 @@ int cmCPackNSISGenerator::PackageFiles()
|
||||
std::string nsisPreArguments;
|
||||
if (cmValue nsisArguments =
|
||||
this->GetOption("CPACK_NSIS_EXECUTABLE_PRE_ARGUMENTS")) {
|
||||
std::vector<std::string> expandedArguments;
|
||||
cmExpandList(nsisArguments, expandedArguments);
|
||||
cmList expandedArguments{ nsisArguments };
|
||||
|
||||
for (auto& arg : expandedArguments) {
|
||||
if (!cmHasPrefix(arg, NSIS_OPT)) {
|
||||
@@ -260,8 +259,7 @@ int cmCPackNSISGenerator::PackageFiles()
|
||||
std::string nsisPostArguments;
|
||||
if (cmValue nsisArguments =
|
||||
this->GetOption("CPACK_NSIS_EXECUTABLE_POST_ARGUMENTS")) {
|
||||
std::vector<std::string> expandedArguments;
|
||||
cmExpandList(nsisArguments, expandedArguments);
|
||||
cmList expandedArguments{ nsisArguments };
|
||||
for (auto& arg : expandedArguments) {
|
||||
if (!cmHasPrefix(arg, NSIS_OPT)) {
|
||||
nsisPostArguments = cmStrCat(nsisPostArguments, NSIS_OPT);
|
||||
@@ -546,14 +544,14 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||
this->GetOption("CPACK_CREATE_DESKTOP_LINKS");
|
||||
cmValue cpackNsisExecutablesDirectory =
|
||||
this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY");
|
||||
std::vector<std::string> cpackPackageDesktopLinksVector;
|
||||
cmList cpackPackageDesktopLinksList;
|
||||
if (cpackPackageDeskTopLinks) {
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
"CPACK_CREATE_DESKTOP_LINKS: " << cpackPackageDeskTopLinks
|
||||
<< std::endl);
|
||||
|
||||
cmExpandList(cpackPackageDeskTopLinks, cpackPackageDesktopLinksVector);
|
||||
for (std::string const& cpdl : cpackPackageDesktopLinksVector) {
|
||||
cpackPackageDesktopLinksList.assign(cpackPackageDeskTopLinks);
|
||||
for (std::string const& cpdl : cpackPackageDesktopLinksList) {
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
"CPACK_CREATE_DESKTOP_LINKS: " << cpdl << std::endl);
|
||||
}
|
||||
@@ -592,7 +590,7 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||
<< ".lnk\"" << std::endl;
|
||||
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
|
||||
// if so add a desktop link
|
||||
if (cm::contains(cpackPackageDesktopLinksVector, execName)) {
|
||||
if (cm::contains(cpackPackageDesktopLinksList, execName)) {
|
||||
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||
str << " CreateShortCut \"$DESKTOP\\" << linkName
|
||||
<< R"(.lnk" "$INSTDIR\)" << cpackNsisExecutablesDirectory << "\\"
|
||||
|
||||
Reference in New Issue
Block a user