From ff42dec89143c3b8027c9768c2910ca270ddd951 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <sebholt@xwmw.org>
Date: Sun, 11 Aug 2019 11:36:39 +0200
Subject: cmStringAlgorithms: Add cmExpandList functions

---
 Source/cmStringAlgorithms.cxx | 71 +++++++++++++++++++++++++++++++++++++++++++
 Source/cmStringAlgorithms.h   | 42 +++++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx
index eca761b..c77fde3 100644
--- a/Source/cmStringAlgorithms.cxx
+++ b/Source/cmStringAlgorithms.cxx
@@ -72,6 +72,77 @@ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep)
   return tokens;
 }
 
+void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut,
+                  bool emptyArgs)
+{
+  // If argument is empty, it is an empty list.
+  if (!emptyArgs && arg.empty()) {
+    return;
+  }
+
+  // if there are no ; in the name then just copy the current string
+  if (arg.find(';') == cm::string_view::npos) {
+    argsOut.emplace_back(arg);
+    return;
+  }
+
+  std::string newArg;
+  // Break the string at non-escaped semicolons not nested in [].
+  int squareNesting = 0;
+  cm::string_view::iterator last = arg.begin();
+  cm::string_view::iterator const cend = arg.end();
+  for (cm::string_view::iterator c = last; c != cend; ++c) {
+    switch (*c) {
+      case '\\': {
+        // We only want to allow escaping of semicolons.  Other
+        // escapes should not be processed here.
+        cm::string_view::iterator cnext = c + 1;
+        if ((cnext != cend) && *cnext == ';') {
+          newArg.append(last, c);
+          // Skip over the escape character
+          last = cnext;
+          c = cnext;
+        }
+      } break;
+      case '[': {
+        ++squareNesting;
+      } break;
+      case ']': {
+        --squareNesting;
+      } break;
+      case ';': {
+        // Break the string here if we are not nested inside square
+        // brackets.
+        if (squareNesting == 0) {
+          newArg.append(last, c);
+          // Skip over the semicolon
+          last = c + 1;
+          if (!newArg.empty() || emptyArgs) {
+            // Add the last argument if the string is not empty.
+            argsOut.push_back(newArg);
+            newArg.clear();
+          }
+        }
+      } break;
+      default: {
+        // Just append this character.
+      } break;
+    }
+  }
+  newArg.append(last, cend);
+  if (!newArg.empty() || emptyArgs) {
+    // Add the last argument if the string is not empty.
+    argsOut.push_back(std::move(newArg));
+  }
+}
+
+std::vector<std::string> cmExpandedList(cm::string_view arg, bool emptyArgs)
+{
+  std::vector<std::string> argsOut;
+  cmExpandList(arg, argsOut, emptyArgs);
+  return argsOut;
+}
+
 namespace {
 template <std::size_t N, typename T>
 inline void MakeDigits(cm::string_view& view, char (&digits)[N],
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 44b01b8..52d187c 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -68,6 +68,48 @@ std::string cmJoin(Range const& rng, cm::string_view separator)
 /** Extract tokens that are separated by any of the characters in @a sep.  */
 std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep);
 
+/**
+ * Expand the ; separated string @a arg into multiple arguments.
+ * All found arguments are appended to @a argsOut.
+ */
+void cmExpandList(cm::string_view arg, std::vector<std::string>& argsOut,
+                  bool emptyArgs = false);
+
+/**
+ * Expand out any arguments in the string range [@a first, @a last) that have
+ * ; separated strings into multiple arguments.  All found arguments are
+ * appended to @a argsOut.
+ */
+template <class InputIt>
+void cmExpandLists(InputIt first, InputIt last,
+                   std::vector<std::string>& argsOut)
+{
+  for (; first != last; ++first) {
+    ExpandList(*first, argsOut);
+  }
+}
+
+/**
+ * Same as cmExpandList but a new vector is created containing
+ * the expanded arguments from the string @a arg.
+ */
+std::vector<std::string> cmExpandedList(cm::string_view arg,
+                                        bool emptyArgs = false);
+
+/**
+ * Same as cmExpandList but a new vector is created containing the expanded
+ * versions of all arguments in the string range [@a first, @a last).
+ */
+template <class InputIt>
+std::vector<std::string> cmExpandedLists(InputIt first, InputIt last)
+{
+  std::vector<std::string> argsOut;
+  for (; first != last; ++first) {
+    cmExpandList(*first, argsOut);
+  }
+  return argsOut;
+}
+
 /** Concatenate string pieces into a single string.  */
 std::string cmCatViews(std::initializer_list<cm::string_view> views);
 
-- 
cgit v0.12


From f4f3c68926492e5660c4e66d5cdcf2298619c1b9 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <sebholt@xwmw.org>
Date: Sun, 11 Aug 2019 11:56:59 +0200
Subject: Source code: Use cmExpandList instead of
 cmSystemTools::ExpandListArgument

---
 Source/CPack/IFW/cmCPackIFWCommon.cxx              |  5 +-
 Source/CPack/IFW/cmCPackIFWGenerator.cxx           |  7 +-
 Source/CPack/IFW/cmCPackIFWInstaller.cxx           |  3 +-
 Source/CPack/IFW/cmCPackIFWPackage.cxx             | 19 +++--
 Source/CPack/WiX/cmCPackWIXGenerator.cxx           | 18 ++--
 Source/CPack/cmCPackBundleGenerator.cxx            |  3 +-
 Source/CPack/cmCPackDebGenerator.cxx               |  3 +-
 Source/CPack/cmCPackDragNDropGenerator.cxx         |  6 +-
 Source/CPack/cmCPackFreeBSDGenerator.cxx           | 10 +--
 Source/CPack/cmCPackGenerator.cxx                  | 22 +++--
 Source/CPack/cmCPackNSISGenerator.cxx              |  9 +-
 Source/CPack/cmCPackOSXX11Generator.cxx            |  4 +-
 Source/CPack/cpack.cxx                             |  3 +-
 Source/CTest/cmCTestBuildHandler.cxx               |  6 +-
 Source/CTest/cmCTestConfigureCommand.cxx           |  3 +-
 Source/CTest/cmCTestGIT.cxx                        |  2 +-
 Source/CTest/cmCTestP4.cxx                         |  3 +-
 Source/CTest/cmCTestScriptHandler.cxx              |  6 +-
 Source/CTest/cmCTestSubmitCommand.cxx              |  5 +-
 Source/CTest/cmCTestSubmitHandler.cxx              |  4 +-
 Source/CTest/cmCTestTestHandler.cxx                | 34 ++++----
 .../CursesDialog/cmCursesCacheEntryComposite.cxx   |  3 +-
 Source/cmCTest.cxx                                 |  6 +-
 Source/cmCacheManager.cxx                          |  3 +-
 Source/cmComputeLinkDepends.cxx                    |  3 +-
 Source/cmComputeLinkInformation.cxx                | 22 ++---
 Source/cmConditionEvaluator.cxx                    |  2 +-
 Source/cmCoreTryCompile.cxx                        |  4 +-
 Source/cmCustomCommandGenerator.cxx                | 10 +--
 Source/cmDepends.cxx                               |  7 +-
 Source/cmDependsC.cxx                              |  3 +-
 Source/cmDependsFortran.cxx                        |  4 +-
 Source/cmExportBuildAndroidMKGenerator.cxx         |  4 +-
 Source/cmExportFileGenerator.cxx                   |  4 +-
 Source/cmExportTryCompileFileGenerator.cxx         |  4 +-
 Source/cmExtraCodeBlocksGenerator.cxx              |  6 +-
 Source/cmExtraEclipseCDT4Generator.cxx             | 11 +--
 Source/cmExtraSublimeTextGenerator.cxx             |  2 +-
 Source/cmFileCopier.cxx                            |  2 +-
 Source/cmFindCommon.cxx                            |  5 +-
 Source/cmFindLibraryCommand.cxx                    |  5 +-
 Source/cmFindPackageCommand.cxx                    |  6 +-
 Source/cmForEachCommand.cxx                        |  3 +-
 Source/cmGeneratorExpression.cxx                   |  5 +-
 Source/cmGeneratorExpressionNode.cxx               | 22 +++--
 Source/cmGeneratorTarget.cxx                       | 97 ++++++++++------------
 Source/cmGhsMultiTargetGenerator.cxx               |  2 +-
 Source/cmGlobalGenerator.cxx                       | 18 ++--
 Source/cmGlobalGhsMultiGenerator.cxx               |  2 +-
 Source/cmGlobalVisualStudio71Generator.cxx         |  2 +-
 Source/cmGlobalVisualStudio7Generator.cxx          |  3 +-
 Source/cmGlobalVisualStudio8Generator.cxx          |  2 +-
 Source/cmGlobalXCodeGenerator.cxx                  | 13 ++-
 Source/cmGraphVizWriter.cxx                        |  4 +-
 Source/cmIDEOptions.cxx                            |  6 +-
 Source/cmInstallCommand.cxx                        |  6 +-
 Source/cmInstallDirectoryGenerator.cxx             |  3 +-
 Source/cmInstallFilesGenerator.cxx                 |  5 +-
 Source/cmInstalledFile.cxx                         |  3 +-
 Source/cmLDConfigLDConfigTool.cxx                  |  3 +-
 Source/cmListCommand.cxx                           |  6 +-
 Source/cmListFileCache.cxx                         |  3 +-
 Source/cmLocalGenerator.cxx                        | 28 +++----
 Source/cmLocalNinjaGenerator.cxx                   |  5 +-
 Source/cmLocalUnixMakefileGenerator3.cxx           | 13 ++-
 Source/cmLocalVisualStudio7Generator.cxx           |  2 +-
 Source/cmMakefile.cxx                              | 36 ++++----
 Source/cmMakefileExecutableTargetGenerator.cxx     |  6 +-
 Source/cmMakefileLibraryTargetGenerator.cxx        | 10 +--
 Source/cmMakefileTargetGenerator.cxx               | 21 +++--
 Source/cmMessageCommand.cxx                        |  7 +-
 Source/cmNinjaNormalTargetGenerator.cxx            | 10 +--
 Source/cmNinjaTargetGenerator.cxx                  | 27 +++---
 Source/cmOutputConverter.cxx                       |  3 +-
 Source/cmOutputRequiredFilesCommand.cxx            |  2 +-
 Source/cmParseArgumentsCommand.cxx                 |  8 +-
 Source/cmQtAutoGenInitializer.cxx                  | 12 +--
 Source/cmQtAutoMocUic.cxx                          |  7 +-
 Source/cmQtAutoRcc.cxx                             |  4 +-
 Source/cmRemoveCommand.cxx                         |  7 +-
 Source/cmRuntimeDependencyArchive.cxx              |  3 +-
 Source/cmSearchPath.cxx                            |  4 +-
 Source/cmSystemTools.h                             |  4 +-
 Source/cmTarget.cxx                                | 10 +--
 Source/cmTestGenerator.cxx                         |  5 +-
 Source/cmTryRunCommand.cxx                         |  3 +-
 Source/cmVisualStudio10TargetGenerator.cxx         | 10 +--
 Source/cmXCodeScheme.cxx                           |  4 +-
 Source/cmake.cxx                                   | 14 ++--
 Source/cmcmd.cxx                                   | 11 ++-
 90 files changed, 381 insertions(+), 394 deletions(-)

diff --git a/Source/CPack/IFW/cmCPackIFWCommon.cxx b/Source/CPack/IFW/cmCPackIFWCommon.cxx
index 1e72641..5b1ccbd 100644
--- a/Source/CPack/IFW/cmCPackIFWCommon.cxx
+++ b/Source/CPack/IFW/cmCPackIFWCommon.cxx
@@ -5,6 +5,7 @@
 #include "cmCPackGenerator.h"
 #include "cmCPackIFWGenerator.h"
 #include "cmCPackLog.h" // IWYU pragma: keep
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmTimestamp.h"
 #include "cmVersionConfig.h"
@@ -78,7 +79,7 @@ void cmCPackIFWCommon::ExpandListArgument(
   const std::string& arg, std::map<std::string, std::string>& argsOut)
 {
   std::vector<std::string> args;
-  cmSystemTools::ExpandListArgument(arg, args, false);
+  cmExpandList(arg, args, false);
   if (args.empty()) {
     return;
   }
@@ -100,7 +101,7 @@ void cmCPackIFWCommon::ExpandListArgument(
   const std::string& arg, std::multimap<std::string, std::string>& argsOut)
 {
   std::vector<std::string> args;
-  cmSystemTools::ExpandListArgument(arg, args, false);
+  cmExpandList(arg, args, false);
   if (args.empty()) {
     return;
   }
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index c1b6eea..76eb760 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -11,6 +11,7 @@
 #include "cmCPackLog.h" // IWYU pragma: keep
 #include "cmDuration.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include <sstream>
@@ -292,14 +293,14 @@ int cmCPackIFWGenerator::InitializeInternal()
   // Additional packages dirs
   this->PkgsDirsVector.clear();
   if (const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES")) {
-    cmSystemTools::ExpandListArgument(dirs, this->PkgsDirsVector);
+    cmExpandList(dirs, this->PkgsDirsVector);
   }
 
   // Additional repositories dirs
   this->RepoDirsVector.clear();
   if (const char* dirs =
         this->GetOption("CPACK_IFW_REPOSITORIES_DIRECTORIES")) {
-    cmSystemTools::ExpandListArgument(dirs, this->RepoDirsVector);
+    cmExpandList(dirs, this->RepoDirsVector);
   }
 
   // Installer
@@ -317,7 +318,7 @@ int cmCPackIFWGenerator::InitializeInternal()
   // Repositories
   if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
     std::vector<std::string> RepoAllVector;
-    cmSystemTools::ExpandListArgument(RepoAllStr, RepoAllVector);
+    cmExpandList(RepoAllStr, RepoAllVector);
     for (std::string const& r : RepoAllVector) {
       this->GetRepository(r);
     }
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index f130e05..5313dd0 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -245,8 +245,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
   if (const char* optIFW_PACKAGE_RESOURCES =
         this->GetOption("CPACK_IFW_PACKAGE_RESOURCES")) {
     this->Resources.clear();
-    cmSystemTools::ExpandListArgument(optIFW_PACKAGE_RESOURCES,
-                                      this->Resources);
+    cmExpandList(optIFW_PACKAGE_RESOURCES, this->Resources);
   }
 }
 
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index a1a52b1..7407c49 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -8,6 +8,7 @@
 #include "cmCPackIFWInstaller.h"
 #include "cmCPackLog.h" // IWYU pragma: keep
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmTimestamp.h"
 #include "cmXMLWriter.h"
@@ -196,7 +197,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
   // User interfaces
   if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
     this->UserInterfaces.clear();
-    cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
+    cmExpandList(option, this->UserInterfaces);
   }
 
   // CMake dependencies
@@ -209,7 +210,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
   // Licenses
   if (const char* option = this->GetOption(prefix + "LICENSES")) {
     this->Licenses.clear();
-    cmSystemTools::ExpandListArgument(option, this->Licenses);
+    cmExpandList(option, this->Licenses);
     if (this->Licenses.size() % 2 != 0) {
       cmCPackIFWLogger(
         WARNING,
@@ -281,13 +282,13 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
   // User interfaces
   if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
     this->UserInterfaces.clear();
-    cmSystemTools::ExpandListArgument(option, this->UserInterfaces);
+    cmExpandList(option, this->UserInterfaces);
   }
 
   // Licenses
   if (const char* option = this->GetOption(prefix + "LICENSES")) {
     this->Licenses.clear();
-    cmSystemTools::ExpandListArgument(option, this->Licenses);
+    cmExpandList(option, this->Licenses);
     if (this->Licenses.size() % 2 != 0) {
       cmCPackIFWLogger(
         WARNING,
@@ -398,18 +399,18 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
     this->Translations.clear();
   } else if (const char* value = this->GetOption(option)) {
     this->Translations.clear();
-    cmSystemTools::ExpandListArgument(value, this->Translations);
+    cmExpandList(value, this->Translations);
   }
 
   // QtIFW dependencies
   std::vector<std::string> deps;
   option = prefix + "DEPENDS";
   if (const char* value = this->GetOption(option)) {
-    cmSystemTools::ExpandListArgument(value, deps);
+    cmExpandList(value, deps);
   }
   option = prefix + "DEPENDENCIES";
   if (const char* value = this->GetOption(option)) {
-    cmSystemTools::ExpandListArgument(value, deps);
+    cmExpandList(value, deps);
   }
   for (std::string const& d : deps) {
     DependenceStruct dep(d);
@@ -431,7 +432,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
     this->AlienAutoDependOn.clear();
   } else if (const char* value = this->GetOption(option)) {
     std::vector<std::string> depsOn;
-    cmSystemTools::ExpandListArgument(value, depsOn);
+    cmExpandList(value, depsOn);
     for (std::string const& d : depsOn) {
       DependenceStruct dep(d);
       if (this->Generator->Packages.count(dep.Name)) {
@@ -488,7 +489,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
     this->Replaces.clear();
   } else if (const char* value = this->GetOption(option)) {
     this->Replaces.clear();
-    cmSystemTools::ExpandListArgument(value, this->Replaces);
+    cmExpandList(value, this->Replaces);
   }
 
   // Requires admin rights
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index fa64d79..458a335 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -7,6 +7,7 @@
 #include "cmCryptoHash.h"
 #include "cmGeneratedFileStream.h"
 #include "cmInstalledFile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmUuid.h"
 #include <algorithm>
@@ -226,7 +227,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
   const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
   if (patchFilePath) {
     std::vector<std::string> patchFilePaths;
-    cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths);
+    cmExpandList(patchFilePath, patchFilePaths);
 
     for (std::string const& p : patchFilePaths) {
       if (!this->Patch->LoadFragments(p)) {
@@ -300,7 +301,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources()
   if (!cpackWixExtraSources)
     return;
 
-  cmSystemTools::ExpandListArgument(cpackWixExtraSources, this->WixSources);
+  cmExpandList(cpackWixExtraSources, this->WixSources);
 }
 
 void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
@@ -311,8 +312,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
 
   std::vector<std::string> expandedExtraObjects;
 
-  cmSystemTools::ExpandListArgument(cpackWixExtraObjects,
-                                    expandedExtraObjects);
+  cmExpandList(cpackWixExtraObjects, expandedExtraObjects);
 
   for (std::string const& obj : expandedExtraObjects) {
     stream << " " << QuotePath(obj);
@@ -664,8 +664,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
   std::vector<std::string> cpackPackageExecutablesList;
   const char* cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
   if (cpackPackageExecutables) {
-    cmSystemTools::ExpandListArgument(cpackPackageExecutables,
-                                      cpackPackageExecutablesList);
+    cmExpandList(cpackPackageExecutables, cpackPackageExecutablesList);
     if (cpackPackageExecutablesList.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
@@ -680,8 +679,7 @@ bool cmCPackWIXGenerator::AddComponentsToFeature(
   const char* cpackPackageDesktopLinks =
     GetOption("CPACK_CREATE_DESKTOP_LINKS");
   if (cpackPackageDesktopLinks) {
-    cmSystemTools::ExpandListArgument(cpackPackageDesktopLinks,
-                                      cpackPackageDesktopLinksList);
+    cmExpandList(cpackPackageDesktopLinks, cpackPackageDesktopLinksList);
   }
 
   AddDirectoryAndFileDefinitions(
@@ -1137,7 +1135,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
     return;
 
   std::vector<std::string> list;
-  cmSystemTools::ExpandListArgument(variableContent, list);
+  cmExpandList(variableContent, list);
   extensions.insert(list.begin(), list.end());
 }
 
@@ -1149,7 +1147,7 @@ void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,
     return;
 
   std::vector<std::string> list;
-  cmSystemTools::ExpandListArgument(variableContent, list);
+  cmExpandList(variableContent, list);
 
   for (std::string const& i : list) {
     stream << " " << QuotePath(i);
diff --git a/Source/CPack/cmCPackBundleGenerator.cxx b/Source/CPack/cmCPackBundleGenerator.cxx
index 3a476f4..213ce92 100644
--- a/Source/CPack/cmCPackBundleGenerator.cxx
+++ b/Source/CPack/cmCPackBundleGenerator.cxx
@@ -6,6 +6,7 @@
 #include <vector>
 
 #include "cmCPackLog.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 cmCPackBundleGenerator::cmCPackBundleGenerator() = default;
@@ -206,7 +207,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
       : "";
 
     std::vector<std::string> relFiles;
-    cmSystemTools::ExpandListArgument(sign_files, relFiles);
+    cmExpandList(sign_files, relFiles);
 
     // sign the files supplied by the user, ie. frameworks.
     for (auto const& file : relFiles) {
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index cfb5efd..06b9876 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -8,6 +8,7 @@
 #include "cmCPackLog.h"
 #include "cmCryptoHash.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cm_sys_stat.h"
 
@@ -378,7 +379,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
     control_tar.ClearPermissions();
 
     std::vector<std::string> controlExtraList;
-    cmSystemTools::ExpandListArgument(ControlExtra, controlExtraList);
+    cmExpandList(ControlExtra, controlExtraList);
     for (std::string const& i : controlExtraList) {
       std::string filenamename = cmsys::SystemTools::GetFilenameName(i);
       std::string localcopy = WorkDir + "/" + filenamename;
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index 7a3742b..85faa61 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -6,6 +6,7 @@
 #include "cmCPackLog.h"
 #include "cmDuration.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include "cmsys/FStream.hxx"
@@ -128,8 +129,7 @@ int cmCPackDragNDropGenerator::InitializeInternal()
     }
 
     std::vector<std::string> languages;
-    cmSystemTools::ExpandListArgument(
-      this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages);
+    cmExpandList(this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages);
     if (languages.empty()) {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
                     "CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl);
@@ -527,7 +527,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
 
     std::vector<std::string> languages;
     if (!oldStyle) {
-      cmSystemTools::ExpandListArgument(cpack_dmg_languages, languages);
+      cmExpandList(cpack_dmg_languages, languages);
     }
 
     cmGeneratedFileStream ofs(sla_r);
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 9fdafa4..b90a27c 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -6,6 +6,7 @@
 #include "cmCPackArchiveGenerator.h"
 #include "cmCPackLog.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 // Needed for ::open() and ::stat()
@@ -228,8 +229,7 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
     "desc", var_lookup("CPACK_FREEBSD_PACKAGE_DESCRIPTION"));
   manifest << ManifestKeyValue("www", var_lookup("CPACK_FREEBSD_PACKAGE_WWW"));
   std::vector<std::string> licenses;
-  cmSystemTools::ExpandListArgument(
-    var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"), licenses);
+  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"), licenses);
   std::string licenselogic("single");
   if (licenses.empty()) {
     cmSystemTools::SetFatalErrorOccured();
@@ -239,13 +239,11 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
   manifest << ManifestKeyValue("licenselogic", licenselogic);
   manifest << (ManifestKeyListValue("licenses") << licenses);
   std::vector<std::string> categories;
-  cmSystemTools::ExpandListArgument(
-    var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"), categories);
+  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"), categories);
   manifest << (ManifestKeyListValue("categories") << categories);
   manifest << ManifestKeyValue("prefix", var_lookup("CMAKE_INSTALL_PREFIX"));
   std::vector<std::string> deps;
-  cmSystemTools::ExpandListArgument(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"),
-                                    deps);
+  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"), deps);
   if (!deps.empty()) {
     manifest << (ManifestKeyDepsValue("deps") << deps);
   }
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 3fd124b..e31787c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -212,7 +212,7 @@ int cmCPackGenerator::InstallProject()
     this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
   if (default_dir_install_permissions && *default_dir_install_permissions) {
     std::vector<std::string> items;
-    cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
+    cmExpandList(default_dir_install_permissions, items);
     for (const auto& arg : items) {
       if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) {
         cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -275,7 +275,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
     tempInstallDirectoryEnv += tempInstallDirectory;
     cmSystemTools::PutEnv(tempInstallDirectoryEnv);
     std::vector<std::string> installCommandsVector;
-    cmSystemTools::ExpandListArgument(installCommands, installCommandsVector);
+    cmExpandList(installCommands, installCommandsVector);
     for (std::string const& ic : installCommandsVector) {
       cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
       std::string output;
@@ -312,8 +312,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
   const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
   if (cpackIgnoreFiles) {
     std::vector<std::string> ignoreFilesRegexString;
-    cmSystemTools::ExpandListArgument(cpackIgnoreFiles,
-                                      ignoreFilesRegexString);
+    cmExpandList(cpackIgnoreFiles, ignoreFilesRegexString);
     for (std::string const& ifr : ignoreFilesRegexString) {
       cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                     "Create ignore files regex for: " << ifr << std::endl);
@@ -324,8 +323,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
     this->GetOption("CPACK_INSTALLED_DIRECTORIES");
   if (installDirectories && *installDirectories) {
     std::vector<std::string> installDirectoriesVector;
-    cmSystemTools::ExpandListArgument(installDirectories,
-                                      installDirectoriesVector);
+    cmExpandList(installDirectories, installDirectoriesVector);
     if (installDirectoriesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
@@ -466,7 +464,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
     cmCPackLogger(cmCPackLog::LOG_OUTPUT,
                   "- Install scripts: " << cmakeScripts << std::endl);
     std::vector<std::string> cmakeScriptsVector;
-    cmSystemTools::ExpandListArgument(cmakeScripts, cmakeScriptsVector);
+    cmExpandList(cmakeScripts, cmakeScriptsVector);
     for (std::string const& installScript : cmakeScriptsVector) {
 
       cmCPackLogger(cmCPackLog::LOG_OUTPUT,
@@ -531,7 +529,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
       return 0;
     }
     std::vector<std::string> cmakeProjectsVector;
-    cmSystemTools::ExpandListArgument(cmakeProjects, cmakeProjectsVector);
+    cmExpandList(cmakeProjects, cmakeProjectsVector);
     std::vector<std::string>::iterator it;
     for (it = cmakeProjectsVector.begin(); it != cmakeProjectsVector.end();
          ++it) {
@@ -576,7 +574,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
         const char* installTypes = this->GetOption(installTypesVar);
         if (installTypes && *installTypes) {
           std::vector<std::string> installTypesVector;
-          cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
+          cmExpandList(installTypes, installTypesVector);
           for (std::string const& installType : installTypesVector) {
             project.InstallationTypes.push_back(
               this->GetInstallationType(project.ProjectName, installType));
@@ -588,7 +586,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component);
         const char* components = this->GetOption(componentsVar);
         if (components && *components) {
-          cmSystemTools::ExpandListArgument(components, componentsVector);
+          cmExpandList(components, componentsVector);
           for (std::string const& comp : componentsVector) {
             project.Components.push_back(
               this->GetComponent(project.ProjectName, comp));
@@ -1505,7 +1503,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
     const char* installTypes = this->GetOption(macroPrefix + "_INSTALL_TYPES");
     if (installTypes && *installTypes) {
       std::vector<std::string> installTypesVector;
-      cmSystemTools::ExpandListArgument(installTypes, installTypesVector);
+      cmExpandList(installTypes, installTypesVector);
       for (std::string const& installType : installTypesVector) {
         component->InstallationTypes.push_back(
           this->GetInstallationType(projectName, installType));
@@ -1516,7 +1514,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
     const char* depends = this->GetOption(macroPrefix + "_DEPENDS");
     if (depends && *depends) {
       std::vector<std::string> dependsVector;
-      cmSystemTools::ExpandListArgument(depends, dependsVector);
+      cmExpandList(depends, dependsVector);
       for (std::string const& depend : dependsVector) {
         cmCPackComponent* child = GetComponent(projectName, depend);
         component->Dependencies.push_back(child);
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 87c36fa..cfa34dc 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -7,6 +7,7 @@
 #include "cmCPackLog.h"
 #include "cmDuration.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include "cmsys/Directory.hxx"
@@ -459,8 +460,7 @@ int cmCPackNSISGenerator::InitializeInternal()
                   "CPACK_CREATE_DESKTOP_LINKS: " << cpackPackageDeskTopLinks
                                                  << std::endl);
 
-    cmSystemTools::ExpandListArgument(cpackPackageDeskTopLinks,
-                                      cpackPackageDesktopLinksVector);
+    cmExpandList(cpackPackageDeskTopLinks, cpackPackageDesktopLinksVector);
     for (std::string const& cpdl : cpackPackageDesktopLinksVector) {
       cmCPackLogger(cmCPackLog::LOG_DEBUG,
                     "CPACK_CREATE_DESKTOP_LINKS: " << cpdl << std::endl);
@@ -479,8 +479,7 @@ int cmCPackNSISGenerator::InitializeInternal()
                   "The cpackPackageExecutables: " << cpackPackageExecutables
                                                   << "." << std::endl);
     std::vector<std::string> cpackPackageExecutablesVector;
-    cmSystemTools::ExpandListArgument(cpackPackageExecutables,
-                                      cpackPackageExecutablesVector);
+    cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
     if (cpackPackageExecutablesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
@@ -536,7 +535,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
   cmCPackLogger(cmCPackLog::LOG_DEBUG,
                 "The cpackMenuLinks: " << cpackMenuLinks << "." << std::endl);
   std::vector<std::string> cpackMenuLinksVector;
-  cmSystemTools::ExpandListArgument(cpackMenuLinks, cpackMenuLinksVector);
+  cmExpandList(cpackMenuLinks, cpackMenuLinksVector);
   if (cpackMenuLinksVector.size() % 2 != 0) {
     cmCPackLogger(
       cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 41470c9..7cc48f4 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -8,6 +8,7 @@
 #include "cmCPackLog.h"
 #include "cmDuration.h"
 #include "cmGeneratedFileStream.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cm_sys_stat.h"
 
@@ -29,8 +30,7 @@ int cmCPackOSXX11Generator::PackageFiles()
     std::ostringstream str;
     std::ostringstream deleteStr;
     std::vector<std::string> cpackPackageExecutablesVector;
-    cmSystemTools::ExpandListArgument(cpackPackageExecutables,
-                                      cpackPackageExecutablesVector);
+    cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
     if (cpackPackageExecutablesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index ae56adb..3cf0c10 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -25,6 +25,7 @@
 #include "cmMakefile.h"
 #include "cmState.h"
 #include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -332,7 +333,7 @@ int main(int argc, char const* const* argv)
                   "CPack generator not specified" << std::endl);
     } else {
       std::vector<std::string> generatorsVector;
-      cmSystemTools::ExpandListArgument(genList, generatorsVector);
+      cmExpandList(genList, generatorsVector);
       for (std::string const& gen : generatorsVector) {
         cmMakefile::ScopePushPop raii(&globalMF);
         cmMakefile* mf = &globalMF;
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index b98a4e3..bc7c155 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -247,13 +247,11 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf)
   // Record the user-specified custom warning rules.
   if (const char* customWarningMatchers =
         mf->GetDefinition("CTEST_CUSTOM_WARNING_MATCH")) {
-    cmSystemTools::ExpandListArgument(customWarningMatchers,
-                                      this->ReallyCustomWarningMatches);
+    cmExpandList(customWarningMatchers, this->ReallyCustomWarningMatches);
   }
   if (const char* customWarningExceptions =
         mf->GetDefinition("CTEST_CUSTOM_WARNING_EXCEPTION")) {
-    cmSystemTools::ExpandListArgument(customWarningExceptions,
-                                      this->ReallyCustomWarningExceptions);
+    cmExpandList(customWarningExceptions, this->ReallyCustomWarningExceptions);
   }
 }
 
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 74a932a..eb7ecb5 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -6,6 +6,7 @@
 #include "cmCTestConfigureHandler.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -25,7 +26,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
   std::vector<std::string> options;
 
   if (this->Values[ctc_OPTIONS]) {
-    cmSystemTools::ExpandListArgument(this->Values[ctc_OPTIONS], options);
+    cmExpandList(this->Values[ctc_OPTIONS], options);
   }
 
   if (this->CTest->GetCTestConfiguration("BuildDirectory").empty()) {
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 093017c..e330e22 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -212,7 +212,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
 bool cmCTestGIT::UpdateByCustom(std::string const& custom)
 {
   std::vector<std::string> git_custom_command;
-  cmSystemTools::ExpandListArgument(custom, git_custom_command, true);
+  cmExpandList(custom, git_custom_command, true);
   std::vector<char const*> git_custom;
   git_custom.reserve(git_custom_command.size() + 1);
   for (std::string const& i : git_custom_command) {
diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx
index 2eb8dba..80eb8d9 100644
--- a/Source/CTest/cmCTestP4.cxx
+++ b/Source/CTest/cmCTestP4.cxx
@@ -7,6 +7,7 @@
 #include "cmCTestVC.h"
 #include "cmProcessTools.h"
 #include "cmRange.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include "cmsys/RegularExpression.hxx"
@@ -460,7 +461,7 @@ bool cmCTestP4::LoadModifications()
 bool cmCTestP4::UpdateCustom(const std::string& custom)
 {
   std::vector<std::string> p4_custom_command;
-  cmSystemTools::ExpandListArgument(custom, p4_custom_command, true);
+  cmExpandList(custom, p4_custom_command, true);
 
   std::vector<char const*> p4_custom;
   p4_custom.reserve(p4_custom_command.size() + 1);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 58f88be..1c40a58 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -544,7 +544,7 @@ int cmCTestScriptHandler::RunCurrentScript()
   // set any environment variables
   if (!this->CTestEnv.empty()) {
     std::vector<std::string> envArgs;
-    cmSystemTools::ExpandListArgument(this->CTestEnv, envArgs);
+    cmExpandList(this->CTestEnv, envArgs);
     cmSystemTools::AppendEnv(envArgs);
   }
 
@@ -651,7 +651,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
   command = this->UpdateCmd;
   for (std::string const& eu : this->ExtraUpdates) {
     std::vector<std::string> cvsArgs;
-    cmSystemTools::ExpandListArgument(eu, cvsArgs);
+    cmExpandList(eu, cvsArgs);
     if (cvsArgs.size() == 2) {
       std::string fullCommand = command;
       fullCommand += " update ";
@@ -795,7 +795,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
 
   // run ctest, it may be more than one command in here
   std::vector<std::string> ctestCommands;
-  cmSystemTools::ExpandListArgument(this->CTestCmd, ctestCommands);
+  cmExpandList(this->CTestCmd, ctestCommands);
   // for each variable/argument do a putenv
   for (std::string const& ctestCommand : ctestCommands) {
     command = ctestCommand;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 58c0a1b..ec1e9bb 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -7,6 +7,7 @@
 #include "cmCommand.h"
 #include "cmMakefile.h"
 #include "cmMessageType.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include <sstream>
@@ -68,7 +69,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
     this->Makefile->GetDefinition("CTEST_NOTES_FILES");
   if (notesFilesVariable) {
     std::vector<std::string> notesFiles;
-    cmSystemTools::ExpandListArgument(notesFilesVariable, notesFiles);
+    cmExpandList(notesFilesVariable, notesFiles);
     this->CTest->GenerateNotesFile(notesFiles);
   }
 
@@ -76,7 +77,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
     this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
   if (extraFilesVariable) {
     std::vector<std::string> extraFiles;
-    cmSystemTools::ExpandListArgument(extraFilesVariable, extraFiles);
+    cmExpandList(extraFilesVariable, extraFiles);
     if (!this->CTest->SubmitExtraFiles(extraFiles)) {
       this->SetError("problem submitting extra files.");
       return nullptr;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 17ef350..051daa0 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -156,7 +156,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
   ::curl_global_init(CURL_GLOBAL_ALL);
   std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
   std::vector<std::string> args;
-  cmSystemTools::ExpandListArgument(curlopt, args);
+  cmExpandList(curlopt, args);
   bool verifyPeerOff = false;
   bool verifyHostOff = false;
   for (std::string const& arg : args) {
@@ -500,7 +500,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
   curl.SetQuiet(this->Quiet);
   std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
   std::vector<std::string> args;
-  cmSystemTools::ExpandListArgument(curlopt, args);
+  cmExpandList(curlopt, args);
   curl.SetCurlOptions(args);
   curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
   curl.SetHttpHeaders(this->HttpHeaders);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 67c24ca..bc56e8e 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2180,7 +2180,7 @@ bool cmCTestTestHandler::SetTestsProperties(
           if (key == "_BACKTRACE_TRIPLES") {
             std::vector<std::string> triples;
             // allow empty args in the triples
-            cmSystemTools::ExpandListArgument(val, triples, true);
+            cmExpandList(val, triples, true);
 
             // Ensure we have complete triples otherwise the data is corrupt.
             if (triples.size() % 3 == 0) {
@@ -2210,32 +2210,32 @@ bool cmCTestTestHandler::SetTestsProperties(
             rt.Disabled = cmSystemTools::IsOn(val);
           }
           if (key == "ATTACHED_FILES") {
-            cmSystemTools::ExpandListArgument(val, rt.AttachedFiles);
+            cmExpandList(val, rt.AttachedFiles);
           }
           if (key == "ATTACHED_FILES_ON_FAIL") {
-            cmSystemTools::ExpandListArgument(val, rt.AttachOnFail);
+            cmExpandList(val, rt.AttachOnFail);
           }
           if (key == "RESOURCE_LOCK") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
 
             rt.LockedResources.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_SETUP") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
 
             rt.FixturesSetup.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_CLEANUP") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
 
             rt.FixturesCleanup.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_REQUIRED") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
 
             rt.FixturesRequired.insert(lval.begin(), lval.end());
           }
@@ -2247,21 +2247,21 @@ bool cmCTestTestHandler::SetTestsProperties(
             rt.Cost = static_cast<float>(atof(val.c_str()));
           }
           if (key == "REQUIRED_FILES") {
-            cmSystemTools::ExpandListArgument(val, rt.RequiredFiles);
+            cmExpandList(val, rt.RequiredFiles);
           }
           if (key == "RUN_SERIAL") {
             rt.RunSerial = cmSystemTools::IsOn(val);
           }
           if (key == "FAIL_REGULAR_EXPRESSION") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
             for (std::string const& cr : lval) {
               rt.ErrorRegularExpressions.emplace_back(cr, cr);
             }
           }
           if (key == "SKIP_REGULAR_EXPRESSION") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
             for (std::string const& cr : lval) {
               rt.SkipRegularExpressions.emplace_back(cr, cr);
             }
@@ -2282,14 +2282,14 @@ bool cmCTestTestHandler::SetTestsProperties(
             }
           }
           if (key == "DEPENDS") {
-            cmSystemTools::ExpandListArgument(val, rt.Depends);
+            cmExpandList(val, rt.Depends);
           }
           if (key == "ENVIRONMENT") {
-            cmSystemTools::ExpandListArgument(val, rt.Environment);
+            cmExpandList(val, rt.Environment);
           }
           if (key == "LABELS") {
             std::vector<std::string> Labels;
-            cmSystemTools::ExpandListArgument(val, Labels);
+            cmExpandList(val, Labels);
             rt.Labels.insert(rt.Labels.end(), Labels.begin(), Labels.end());
             // sort the array
             std::sort(rt.Labels.begin(), rt.Labels.end());
@@ -2310,7 +2310,7 @@ bool cmCTestTestHandler::SetTestsProperties(
           }
           if (key == "PASS_REGULAR_EXPRESSION") {
             std::vector<std::string> lval;
-            cmSystemTools::ExpandListArgument(val, lval);
+            cmExpandList(val, lval);
             for (std::string const& cr : lval) {
               rt.RequiredRegularExpressions.emplace_back(cr, cr);
             }
@@ -2320,7 +2320,7 @@ bool cmCTestTestHandler::SetTestsProperties(
           }
           if (key == "TIMEOUT_AFTER_MATCH") {
             std::vector<std::string> propArgs;
-            cmSystemTools::ExpandListArgument(val, propArgs);
+            cmExpandList(val, propArgs);
             if (propArgs.size() != 2) {
               cmCTestLog(this->CTest, WARNING,
                          "TIMEOUT_AFTER_MATCH expects two arguments, found "
@@ -2328,7 +2328,7 @@ bool cmCTestTestHandler::SetTestsProperties(
             } else {
               rt.AlternateTimeout = cmDuration(atof(propArgs[0].c_str()));
               std::vector<std::string> lval;
-              cmSystemTools::ExpandListArgument(propArgs[1], lval);
+              cmExpandList(propArgs[1], lval);
               for (std::string const& cr : lval) {
                 rt.TimeoutRegularExpressions.emplace_back(cr, cr);
               }
@@ -2371,7 +2371,7 @@ bool cmCTestTestHandler::SetDirectoryProperties(
       if (cwd == rt.Directory) {
         if (key == "LABELS") {
           std::vector<std::string> DirectoryLabels;
-          cmSystemTools::ExpandListArgument(val, DirectoryLabels);
+          cmExpandList(val, DirectoryLabels);
           rt.Labels.insert(rt.Labels.end(), DirectoryLabels.begin(),
                            DirectoryLabels.end());
 
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index c1dd591..4341bf4 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -11,6 +11,7 @@
 #include "cmCursesWidget.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -71,7 +72,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
           new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
         this->Entry = ow;
         std::vector<std::string> options;
-        cmSystemTools::ExpandListArgument(stringsProp, options);
+        cmExpandList(stringsProp, options);
         for (auto const& opt : options) {
           ow->AddOption(opt);
         }
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index c0ca73b..5d38d96 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -1454,7 +1454,7 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml)
       xml.StartElement("Labels");
       std::string l = labels;
       std::vector<std::string> args;
-      cmSystemTools::ExpandListArgument(l, args);
+      cmExpandList(l, args);
       for (std::string const& i : args) {
         xml.Element("Label", i);
       }
@@ -1487,7 +1487,7 @@ std::vector<std::string> cmCTest::GetLabelsForSubprojects()
   std::string labelsForSubprojects =
     this->GetCTestConfiguration("LabelsForSubprojects");
   std::vector<std::string> subprojects;
-  cmSystemTools::ExpandListArgument(labelsForSubprojects, subprojects);
+  cmExpandList(labelsForSubprojects, subprojects);
 
   // sort the array
   std::sort(subprojects.begin(), subprojects.end());
@@ -2565,7 +2565,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def,
   cmCTestLog(this, DEBUG, "PopulateCustomVector: " << def << std::endl);
 
   vec.clear();
-  cmSystemTools::ExpandListArgument(dval, vec);
+  cmExpandList(dval, vec);
 
   for (std::string const& it : vec) {
     cmCTestLog(this, DEBUG, "  -- " << it << std::endl);
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index e8fc350..8ebab0a 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -14,6 +14,7 @@
 #include "cmMessageType.h"
 #include "cmMessenger.h"
 #include "cmState.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmVersion.h"
 
@@ -552,7 +553,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
   if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
     if (e.Value.find(';') != std::string::npos) {
       std::vector<std::string> paths;
-      cmSystemTools::ExpandListArgument(e.Value, paths);
+      cmExpandList(e.Value, paths);
       const char* sep = "";
       e.Value = "";
       for (std::string& i : paths) {
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index f8b78b4..a187f99 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -12,7 +12,6 @@
 #include "cmRange.h"
 #include "cmStateTypes.h"
 #include "cmStringAlgorithms.h"
-#include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmake.h"
 
@@ -439,7 +438,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
   // <item>_LIB_DEPENDS.  The variable contains a semicolon-separated
   // list.  The list contains link-type;item pairs and just items.
   std::vector<std::string> deplist;
-  cmSystemTools::ExpandListArgument(value, deplist);
+  cmExpandList(value, deplist);
 
   // Look for entries meant for this configuration.
   std::vector<cmLinkItem> actual_libs;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 0741f8b..5f5317c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -551,7 +551,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
   libVar += "_IMPLICIT_LINK_LIBRARIES";
   if (const char* libs = this->Makefile->GetDefinition(libVar)) {
     std::vector<std::string> libsVec;
-    cmSystemTools::ExpandListArgument(libs, libsVec);
+    cmExpandList(libs, libsVec);
     for (std::string const& i : libsVec) {
       if (this->ImplicitLinkLibs.find(i) == this->ImplicitLinkLibs.end()) {
         this->AddItem(i, nullptr);
@@ -566,7 +566,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
   dirVar += "_IMPLICIT_LINK_DIRECTORIES";
   if (const char* dirs = this->Makefile->GetDefinition(dirVar)) {
     std::vector<std::string> dirsVec;
-    cmSystemTools::ExpandListArgument(dirs, dirsVec);
+    cmExpandList(dirs, dirsVec);
     this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
   }
 }
@@ -811,7 +811,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
   if (const char* linkSuffixes =
         mf->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS")) {
     std::vector<std::string> linkSuffixVec;
-    cmSystemTools::ExpandListArgument(linkSuffixes, linkSuffixVec);
+    cmExpandList(linkSuffixes, linkSuffixVec);
     for (std::string const& i : linkSuffixVec) {
       this->AddLinkExtension(i.c_str(), LinkUnknown);
     }
@@ -819,7 +819,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
   if (const char* sharedSuffixes =
         mf->GetDefinition("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES")) {
     std::vector<std::string> sharedSuffixVec;
-    cmSystemTools::ExpandListArgument(sharedSuffixes, sharedSuffixVec);
+    cmExpandList(sharedSuffixes, sharedSuffixVec);
     for (std::string const& i : sharedSuffixVec) {
       this->AddLinkExtension(i.c_str(), LinkShared);
     }
@@ -1288,7 +1288,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
   // Get platform-wide implicit directories.
   if (const char* implicitLinks = this->Makefile->GetDefinition(
         "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) {
-    cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
+    cmExpandList(implicitLinks, implicitDirVec);
   }
 
   // Get language-specific implicit directories.
@@ -1297,7 +1297,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
   implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES";
   if (const char* implicitDirs =
         this->Makefile->GetDefinition(implicitDirVar)) {
-    cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
+    cmExpandList(implicitDirs, implicitDirVec);
   }
 
   this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
@@ -1516,7 +1516,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
   // Get platform-wide implicit directories.
   if (const char* implicitLinks = (this->Makefile->GetDefinition(
         "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES"))) {
-    cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
+    cmExpandList(implicitLinks, implicitDirVec);
   }
 
   // Append library architecture to all implicit platform directories
@@ -1534,7 +1534,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
   implicitDirVar += "_IMPLICIT_LINK_DIRECTORIES";
   if (const char* implicitDirs =
         this->Makefile->GetDefinition(implicitDirVar)) {
-    cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
+    cmExpandList(implicitDirs, implicitDirVec);
   }
 
   // Store implicit link directories.
@@ -1547,7 +1547,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
   implicitLibVar += "_IMPLICIT_LINK_LIBRARIES";
   if (const char* implicitLibs =
         this->Makefile->GetDefinition(implicitLibVar)) {
-    cmSystemTools::ExpandListArgument(implicitLibs, implicitLibVec);
+    cmExpandList(implicitLibs, implicitLibVec);
   }
 
   // Store implicit link libraries.
@@ -1562,7 +1562,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
   // Get platform specific rpath link directories
   if (const char* rpathDirs =
         (this->Makefile->GetDefinition("CMAKE_PLATFORM_RUNTIME_PATH"))) {
-    cmSystemTools::ExpandListArgument(rpathDirs, this->RuntimeLinkDirs);
+    cmExpandList(rpathDirs, this->RuntimeLinkDirs);
   }
 }
 
@@ -1669,7 +1669,7 @@ static void cmCLI_ExpandListUnique(const char* str,
                                    std::set<std::string>& emitted)
 {
   std::vector<std::string> tmp;
-  cmSystemTools::ExpandListArgument(str, tmp);
+  cmExpandList(str, tmp);
   for (std::string const& i : tmp) {
     if (emitted.insert(i).second) {
       out.push_back(i);
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index 5b88807..3a53067 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -670,7 +670,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
 
           if (def2) {
             std::vector<std::string> list;
-            cmSystemTools::ExpandListArgument(def2, list, true);
+            cmExpandList(def2, list, true);
 
             result = std::find(list.begin(), list.end(), def) != list.end();
           }
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 85ff0a6..c0c4a25 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -234,7 +234,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
     } else if (doing == DoingCMakeFlags) {
       cmakeFlags.push_back(argv[i]);
     } else if (doing == DoingCompileDefinitions) {
-      cmSystemTools::ExpandListArgument(argv[i], compileDefs);
+      cmExpandList(argv[i], compileDefs);
     } else if (doing == DoingLinkOptions) {
       linkOptions.push_back(argv[i]);
     } else if (doing == DoingLinkLibraries) {
@@ -676,7 +676,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
       if (const char* varListStr = this->Makefile->GetDefinition(
             kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
         std::vector<std::string> varList;
-        cmSystemTools::ExpandListArgument(varListStr, varList);
+        cmExpandList(varListStr, varList);
         vars.insert(varList.begin(), varList.end());
       }
 
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 758a69a..20f0ef2 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -10,6 +10,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include <memory>
@@ -35,7 +36,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
         this->GE->Parse(clarg);
       std::string parsed_arg = cge->Evaluate(this->LG, this->Config);
       if (this->CC.GetCommandExpandLists()) {
-        cmAppend(argv, cmSystemTools::ExpandedListArgument(parsed_arg));
+        cmAppend(argv, cmExpandedList(parsed_arg));
       } else {
         argv.push_back(std::move(parsed_arg));
       }
@@ -54,8 +55,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(cmCustomCommand const& cc,
   std::vector<std::string> depends = this->CC.GetDepends();
   for (std::string const& d : depends) {
     std::unique_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(d);
-    std::vector<std::string> result = cmSystemTools::ExpandedListArgument(
-      cge->Evaluate(this->LG, this->Config));
+    std::vector<std::string> result =
+      cmExpandedList(cge->Evaluate(this->LG, this->Config));
     for (std::string& it : result) {
       if (cmSystemTools::FileIsFullPath(it)) {
         it = cmSystemTools::CollapseFullPath(it);
@@ -108,8 +109,7 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
         continue;
       }
 
-      cmSystemTools::ExpandListArgument(emulator_property,
-                                        this->EmulatorsWithArguments[c]);
+      cmExpandList(emulator_property, this->EmulatorsWithArguments[c]);
     }
   }
 }
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index ed76dbf..6623d94 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -7,6 +7,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include "cmsys/FStream.hxx"
@@ -30,7 +31,7 @@ bool cmDepends::Write(std::ostream& makeDepends, std::ostream& internalDepends)
     {
       std::string const srcLang = "CMAKE_DEPENDS_CHECK_" + this->Language;
       cmMakefile* mf = this->LocalGenerator->GetMakefile();
-      cmSystemTools::ExpandListArgument(mf->GetSafeDefinition(srcLang), pairs);
+      cmExpandList(mf->GetSafeDefinition(srcLang), pairs);
     }
     for (std::vector<std::string>::iterator si = pairs.begin();
          si != pairs.end();) {
@@ -241,7 +242,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
   cmMakefile* mf = this->LocalGenerator->GetMakefile();
   includePath = mf->GetDefinition(includePathVar);
   if (includePath) {
-    cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
+    cmExpandList(includePath, this->IncludePath);
   } else {
     // Fallback to the old directory level variable if no per-target var:
     includePathVar = "CMAKE_";
@@ -249,7 +250,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang)
     includePathVar += "_INCLUDE_PATH";
     includePath = mf->GetDefinition(includePathVar);
     if (includePath) {
-      cmSystemTools::ExpandListArgument(includePath, this->IncludePath);
+      cmExpandList(includePath, this->IncludePath);
     }
   }
 }
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index dc49c18..6eefe82 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -9,6 +9,7 @@
 #include "cmFileTime.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #define INCLUDE_REGEX_LINE                                                    \
@@ -391,7 +392,7 @@ void cmDependsC::SetupTransforms()
   std::vector<std::string> transformRules;
   cmMakefile* mf = this->LocalGenerator->GetMakefile();
   if (const char* xform = mf->GetDefinition("CMAKE_INCLUDE_TRANSFORMS")) {
-    cmSystemTools::ExpandListArgument(xform, transformRules, true);
+    cmExpandList(xform, transformRules, true);
   }
   for (std::string const& tr : transformRules) {
     this->ParseTransform(tr);
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 764ba30..63d1c4d 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -82,7 +82,7 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg)
   cmMakefile* mf = this->LocalGenerator->GetMakefile();
   if (const char* c_defines =
         mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran")) {
-    cmSystemTools::ExpandListArgument(c_defines, definitions);
+    cmExpandList(c_defines, definitions);
   }
 
   // translate i.e. FOO=BAR to FOO and add it to the list of defined
@@ -254,7 +254,7 @@ void cmDependsFortran::LocateModules()
   std::vector<std::string> infoFiles;
   if (const char* infoFilesValue =
         mf->GetDefinition("CMAKE_TARGET_LINKED_INFO_FILES")) {
-    cmSystemTools::ExpandListArgument(infoFilesValue, infoFiles);
+    cmExpandList(infoFilesValue, infoFiles);
   }
   for (std::string const& i : infoFiles) {
     std::string targetDir = cmSystemTools::GetFilenamePath(i);
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 5edf7ca..22cc0bc 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -145,7 +145,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
       } else if (property.first == "INTERFACE_INCLUDE_DIRECTORIES") {
         std::string includes = property.second;
         std::vector<std::string> includeList;
-        cmSystemTools::ExpandListArgument(includes, includeList);
+        cmExpandList(includes, includeList);
         os << "LOCAL_EXPORT_C_INCLUDES := ";
         std::string end;
         for (std::string const& i : includeList) {
@@ -156,7 +156,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
       } else if (property.first == "INTERFACE_LINK_OPTIONS") {
         os << "LOCAL_EXPORT_LDFLAGS := ";
         std::vector<std::string> linkFlagsList;
-        cmSystemTools::ExpandListArgument(property.second, linkFlagsList);
+        cmExpandList(property.second, linkFlagsList);
         os << cmJoin(linkFlagsList, " ") << "\n";
       } else {
         os << "# " << property.first << " " << (property.second) << "\n";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 87f9b4c..35d8668 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -500,7 +500,7 @@ void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
     return;
   }
   std::vector<std::string> content;
-  cmSystemTools::ExpandListArgument(p, content);
+  cmExpandList(p, content);
   ifaceProperties.insert(content.begin(), content.end());
 }
 
@@ -1207,7 +1207,7 @@ bool cmExportFileGenerator::PopulateExportProperties(
   auto& targetProperties = gte->Target->GetProperties();
   if (const char* exportProperties =
         targetProperties.GetPropertyValue("EXPORT_PROPERTIES")) {
-    for (auto& prop : cmSystemTools::ExpandedListArgument(exportProperties)) {
+    for (auto& prop : cmExpandedList(exportProperties)) {
       /* Black list reserved properties */
       if (cmHasLiteralPrefix(prop, "IMPORTED_") ||
           cmHasLiteralPrefix(prop, "INTERFACE_")) {
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index a3c9802..f77fd3a 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -9,7 +9,7 @@
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
 #include "cmStateTypes.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
 #include "cmTarget.h"
 
 #include <map>
@@ -104,7 +104,7 @@ void cmExportTryCompileFileGenerator::PopulateProperties(
         this->FindTargets(p, target, std::string(), emitted);
 
       std::vector<std::string> depends;
-      cmSystemTools::ExpandListArgument(evalResult, depends);
+      cmExpandList(evalResult, depends);
       for (std::string const& li : depends) {
         cmGeneratorTarget* tgt =
           target->GetLocalGenerator()->FindGeneratorTargetToUse(li);
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 4146db8..d13e3ce 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -571,15 +571,13 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
     std::string systemIncludeDirs = makefile->GetSafeDefinition(
       "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
     if (!systemIncludeDirs.empty()) {
-      cmAppend(allIncludeDirs,
-               cmSystemTools::ExpandedListArgument(systemIncludeDirs));
+      cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
     }
 
     systemIncludeDirs = makefile->GetSafeDefinition(
       "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
     if (!systemIncludeDirs.empty()) {
-      cmAppend(allIncludeDirs,
-               cmSystemTools::ExpandedListArgument(systemIncludeDirs));
+      cmAppend(allIncludeDirs, cmExpandedList(systemIncludeDirs));
     }
 
     std::vector<std::string>::const_iterator end =
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 06709f1..9ac355c 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -21,6 +21,7 @@
 #include "cmSourceGroup.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmXMLWriter.h"
 #include "cmake.h"
@@ -416,7 +417,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
   if (const char* extraNaturesProp =
         mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_NATURES")) {
     std::vector<std::string> extraNatures;
-    cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures);
+    cmExpandList(extraNaturesProp, extraNatures);
     for (std::string const& n : extraNatures) {
       xml.Element("nature", n);
     }
@@ -803,7 +804,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   if (this->CEnabled && cDefs) {
     // Expand the list.
     std::vector<std::string> defs;
-    cmSystemTools::ExpandListArgument(cDefs, defs, true);
+    cmExpandList(cDefs, defs, true);
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
@@ -836,7 +837,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   if (this->CXXEnabled && cxxDefs) {
     // Expand the list.
     std::vector<std::string> defs;
-    cmSystemTools::ExpandListArgument(cxxDefs, defs, true);
+    cmExpandList(cxxDefs, defs, true);
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
@@ -887,7 +888,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     std::string systemIncludeDirs =
       mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
     std::vector<std::string> dirs;
-    cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
+    cmExpandList(systemIncludeDirs, dirs);
     this->AppendIncludeDirectories(xml, dirs, emmited);
   }
   compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
@@ -895,7 +896,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     std::string systemIncludeDirs =
       mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
     std::vector<std::string> dirs;
-    cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
+    cmExpandList(systemIncludeDirs, dirs);
     this->AppendIncludeDirectories(xml, dirs, emmited);
   }
 
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 67773e0..0c258f7 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -135,7 +135,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
   fout << "\n\t]";
   std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
   std::vector<std::string> tokens;
-  cmSystemTools::ExpandListArgument(this->EnvSettings, tokens);
+  cmExpandList(this->EnvSettings, tokens);
 
   if (!this->EnvSettings.empty()) {
     fout << ",";
diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx
index 62f132d..1d66050 100644
--- a/Source/cmFileCopier.cxx
+++ b/Source/cmFileCopier.cxx
@@ -172,7 +172,7 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
     "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
   if (default_dir_install_permissions && *default_dir_install_permissions) {
     std::vector<std::string> items;
-    cmSystemTools::ExpandListArgument(default_dir_install_permissions, items);
+    cmExpandList(default_dir_install_permissions, items);
     for (const auto& arg : items) {
       if (!this->CheckPermissions(arg, **mode)) {
         this->Status.SetError(
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index a5937a0..102ed4c 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -9,6 +9,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
@@ -195,7 +196,7 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
   // Construct the list of path roots with no trailing slashes.
   std::vector<std::string> roots;
   if (rootPath) {
-    cmSystemTools::ExpandListArgument(rootPath, roots);
+    cmExpandList(rootPath, roots);
   }
   if (sysrootCompile) {
     roots.emplace_back(sysrootCompile);
@@ -261,7 +262,7 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
       continue;
     }
 
-    cmSystemTools::ExpandListArgument(ignorePath, ignore);
+    cmExpandList(ignorePath, ignore);
   }
 
   for (std::string& i : ignore) {
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 73d602d..dc160b5 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -13,6 +13,7 @@
 #include "cmMakefile.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 class cmExecutionStatus;
@@ -237,8 +238,8 @@ cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf)
     this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_PREFIXES");
   std::string const& suffixes_list =
     this->Makefile->GetRequiredDefinition("CMAKE_FIND_LIBRARY_SUFFIXES");
-  cmSystemTools::ExpandListArgument(prefixes_list, this->Prefixes, true);
-  cmSystemTools::ExpandListArgument(suffixes_list, this->Suffixes, true);
+  cmExpandList(prefixes_list, this->Prefixes, true);
+  cmExpandList(suffixes_list, this->Suffixes, true);
   this->RegexFromList(this->PrefixRegexStr, this->Prefixes);
   this->RegexFromList(this->SuffixRegexStr, this->Suffixes);
 
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 0159ca5..d5207fa 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -498,7 +498,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
         // NEW behavior is to honor the <pkg>_ROOT variables.
         std::string const rootVar = this->Name + "_ROOT";
         if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) {
-          cmSystemTools::ExpandListArgument(pkgRoot, rootPaths, false);
+          cmExpandList(pkgRoot, rootPaths, false);
         }
         cmSystemTools::GetPath(rootPaths, rootVar.c_str());
       } break;
@@ -1099,7 +1099,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
   if (foundProp && *foundProp) {
     std::string tmp = foundProp;
 
-    cmSystemTools::ExpandListArgument(tmp, foundContents, false);
+    cmExpandList(tmp, foundContents, false);
     std::vector<std::string>::iterator nameIt =
       std::find(foundContents.begin(), foundContents.end(), this->Name);
     if (nameIt != foundContents.end()) {
@@ -1113,7 +1113,7 @@ void cmFindPackageCommand::AppendToFoundProperty(bool found)
   if (notFoundProp && *notFoundProp) {
     std::string tmp = notFoundProp;
 
-    cmSystemTools::ExpandListArgument(tmp, notFoundContents, false);
+    cmExpandList(tmp, notFoundContents, false);
     std::vector<std::string>::iterator nameIt =
       std::find(notFoundContents.begin(), notFoundContents.end(), this->Name);
     if (nameIt != notFoundContents.end()) {
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index a565786..9c6f1b4 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -17,6 +17,7 @@
 #include "cmMakefile.h"
 #include "cmMessageType.h"
 #include "cmRange.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 class cmForEachFunctionBlocker : public cmFunctionBlocker
@@ -195,7 +196,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
     } else if (doing == DoingLists) {
       const char* value = this->Makefile->GetDefinition(args[i]);
       if (value && *value) {
-        cmSystemTools::ExpandListArgument(value, fb->Args, true);
+        cmExpandList(value, fb->Args, true);
       }
     } else {
       std::ostringstream e;
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 4d3a005..133a72b 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -13,6 +13,7 @@
 #include "cmGeneratorExpressionEvaluator.h"
 #include "cmGeneratorExpressionLexer.h"
 #include "cmGeneratorExpressionParser.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 cmGeneratorExpression::cmGeneratorExpression(cmListFileBacktrace backtrace)
@@ -294,7 +295,7 @@ void cmGeneratorExpression::Split(const std::string& input,
         preGenex = input.substr(startPos + 1, pos - startPos - 1);
       }
       if (!part.empty()) {
-        cmSystemTools::ExpandListArgument(part, output);
+        cmExpandList(part, output);
       }
     }
     pos += 2;
@@ -327,7 +328,7 @@ void cmGeneratorExpression::Split(const std::string& input,
     lastPos = pos;
   }
   if (lastPos < input.size()) {
-    cmSystemTools::ExpandListArgument(input.substr(lastPos), output);
+    cmExpandList(input.substr(lastPos), output);
   }
 }
 
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index f78c72e..53bc3cd 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -281,11 +281,11 @@ static const struct InListNode : public cmGeneratorExpressionNode
       case cmPolicies::WARN:
         if (parameters.front().empty()) {
           check = true;
-          cmSystemTools::ExpandListArgument(parameters[1], checkValues, true);
+          cmExpandList(parameters[1], checkValues, true);
         }
         CM_FALLTHROUGH;
       case cmPolicies::OLD:
-        cmSystemTools::ExpandListArgument(parameters[1], values);
+        cmExpandList(parameters[1], values);
         if (check && values != checkValues) {
           std::ostringstream e;
           e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0085)
@@ -302,7 +302,7 @@ static const struct InListNode : public cmGeneratorExpressionNode
       case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::REQUIRED_ALWAYS:
       case cmPolicies::NEW:
-        cmSystemTools::ExpandListArgument(parameters[1], values, true);
+        cmExpandList(parameters[1], values, true);
         break;
     }
 
@@ -348,7 +348,7 @@ static const struct FilterNode : public cmGeneratorExpressionNode
     }
 
     std::vector<std::string> values, result;
-    cmSystemTools::ExpandListArgument(parameters.front(), values, true);
+    cmExpandList(parameters.front(), values, true);
 
     std::copy_if(values.cbegin(), values.cend(), std::back_inserter(result),
                  [&re, exclude](std::string const& input) {
@@ -377,7 +377,7 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
     }
 
     std::vector<std::string> values;
-    cmSystemTools::ExpandListArgument(parameters.front(), values, true);
+    cmExpandList(parameters.front(), values, true);
 
     auto valuesEnd = cmRemoveDuplicates(values);
     auto valuesBegin = values.cbegin();
@@ -914,8 +914,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
         mapProp += cmSystemTools::UpperCase(context->Config);
         if (const char* mapValue =
               context->CurrentTarget->GetProperty(mapProp)) {
-          cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue),
-                                            mappedConfigs);
+          cmExpandList(cmSystemTools::UpperCase(mapValue), mappedConfigs);
           return std::find(mappedConfigs.begin(), mappedConfigs.end(),
                            cmSystemTools::UpperCase(parameters.front())) !=
               mappedConfigs.end()
@@ -943,7 +942,7 @@ static const struct JoinNode : public cmGeneratorExpressionNode
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(parameters.front(), list);
+    cmExpandList(parameters.front(), list);
     return cmJoin(list, parameters[1]);
   }
 } joinNode;
@@ -1421,7 +1420,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
       const char* imp = nullptr;
       std::string suffix;
       if (gt->Target->GetMappedConfig(context->Config, &loc, &imp, suffix)) {
-        cmSystemTools::ExpandListArgument(loc, objects);
+        cmExpandList(loc, objects);
       }
       context->HadContextSensitiveCondition = true;
     } else {
@@ -1499,8 +1498,7 @@ static const struct CompileFeaturesNode : public cmGeneratorExpressionNode
           reportError(context, content->GetOriginalExpression(), error);
           return std::string();
         }
-        cmSystemTools::ExpandListArgument(featuresKnown,
-                                          availableFeatures[lang]);
+        cmExpandList(featuresKnown, availableFeatures[lang]);
       }
     }
 
@@ -2216,7 +2214,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
     std::vector<std::string> listIn;
-    cmSystemTools::ExpandListArgument(parameters.front(), listIn);
+    cmExpandList(parameters.front(), listIn);
     if (listIn.empty()) {
       reportError(context, content->GetOriginalExpression(),
                   "\"\" is not an absolute path.");
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index c07d7af..9412d82 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -241,10 +241,9 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
   cmGeneratorTarget::TargetPropertyEntry* entry)
 {
   EvaluatedTargetPropertyEntry ee(entry->LinkImplItem, entry->GetBacktrace());
-  cmSystemTools::ExpandListArgument(
-    entry->Evaluate(thisTarget->GetLocalGenerator(), config, false, thisTarget,
-                    dagChecker, lang),
-    ee.Values);
+  cmExpandList(entry->Evaluate(thisTarget->GetLocalGenerator(), config, false,
+                               thisTarget, dagChecker, lang),
+               ee.Values);
   if (entry->GetHadContextSensitiveCondition()) {
     ee.ContextDependent = true;
   }
@@ -723,10 +722,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
   if (const char* dirs =
         depTgt->GetProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")) {
     cmGeneratorExpression ge;
-    cmSystemTools::ExpandListArgument(
-      ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt,
-                               dagChecker, language),
-      result);
+    cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget,
+                                          depTgt, dagChecker, language),
+                 result);
   }
   if (!depTgt->IsImported() || excludeImported) {
     return;
@@ -735,10 +733,9 @@ void handleSystemIncludesDep(cmLocalGenerator* lg,
   if (const char* dirs =
         depTgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")) {
     cmGeneratorExpression ge;
-    cmSystemTools::ExpandListArgument(
-      ge.Parse(dirs)->Evaluate(lg, config, false, headTarget, depTgt,
-                               dagChecker, language),
-      result);
+    cmExpandList(ge.Parse(dirs)->Evaluate(lg, config, false, headTarget,
+                                          depTgt, dagChecker, language),
+                 result);
   }
 }
 }
@@ -1114,10 +1111,9 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
     std::vector<std::string> result;
     for (std::string const& it : this->Target->GetSystemIncludeDirectories()) {
       cmGeneratorExpression ge;
-      cmSystemTools::ExpandListArgument(
-        ge.Parse(it)->Evaluate(this->LocalGenerator, config, false, this,
-                               &dagChecker, language),
-        result);
+      cmExpandList(ge.Parse(it)->Evaluate(this->LocalGenerator, config, false,
+                                          this, &dagChecker, language),
+                   result);
     }
 
     std::vector<cmGeneratorTarget const*> const& deps =
@@ -1282,7 +1278,7 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
         cmGeneratorExpressionContext context(
           headTarget->GetLocalGenerator(), config, false, headTarget,
           headTarget, true, lib.Backtrace, lang);
-        cmSystemTools::ExpandListArgument(
+        cmExpandList(
           lib.Target->EvaluateInterfaceProperty(prop, &context, dagChecker),
           ee.Values);
         ee.ContextDependent = context.HadContextSensitiveCondition;
@@ -1311,10 +1307,9 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
         cge->SetEvaluateForBuildsystem(true);
 
         EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
-        cmSystemTools::ExpandListArgument(
-          cge->Evaluate(headTarget->GetLocalGenerator(), config, false,
-                        headTarget, dagChecker),
-          ee.Values);
+        cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config,
+                                   false, headTarget, dagChecker),
+                     ee.Values);
         if (cge->GetHadContextSensitiveCondition()) {
           ee.ContextDependent = true;
         }
@@ -1407,7 +1402,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
     cmStringRange sourceEntries = this->Target->GetSourceEntries();
     for (std::string const& entry : sourceEntries) {
       std::vector<std::string> items;
-      cmSystemTools::ExpandListArgument(entry, items);
+      cmExpandList(entry, items);
       for (std::string const& item : items) {
         if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
             item.back() == '>') {
@@ -1423,7 +1418,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugSources = !this->DebugSourcesDone &&
@@ -2557,10 +2552,9 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
 
   cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr,
                                              nullptr);
-  cmSystemTools::ExpandListArgument(
-    ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false, this,
-                             &dagChecker),
-    result);
+  cmExpandList(ge.Parse(prop)->Evaluate(this->LocalGenerator, config, false,
+                                        this, &dagChecker),
+               result);
 }
 
 void processILibs(const std::string& config,
@@ -2688,7 +2682,7 @@ void cmTargetTraceDependencies::Trace()
     // Queue dependencies added explicitly by the user.
     if (const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS")) {
       std::vector<std::string> objDeps;
-      cmSystemTools::ExpandListArgument(additionalDeps, objDeps);
+      cmExpandList(additionalDeps, objDeps);
       for (std::string& objDep : objDeps) {
         if (cmSystemTools::FileIsFullPath(objDep)) {
           objDep = cmSystemTools::CollapseFullPath(objDep);
@@ -2909,7 +2903,7 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config,
     archs = this->GetProperty("OSX_ARCHITECTURES");
   }
   if (archs) {
-    cmSystemTools::ExpandListArgument(std::string(archs), archVec);
+    cmExpandList(std::string(archs), archVec);
   }
 }
 
@@ -3074,7 +3068,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugIncludes = !this->DebugIncludesDone &&
@@ -3185,7 +3179,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugOptions = !this->DebugCompileOptionsDone &&
@@ -3232,7 +3226,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugFeatures = !this->DebugCompileFeaturesDone &&
@@ -3281,7 +3275,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugDefines = !this->DebugCompileDefinitionsDone &&
@@ -3356,7 +3350,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugOptions = !this->DebugLinkOptionsDone &&
@@ -3382,7 +3376,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
   const std::string wrapper(this->Makefile->GetSafeDefinition(
     "CMAKE_" + language + "_LINKER_WRAPPER_FLAG"));
   std::vector<std::string> wrapperFlag;
-  cmSystemTools::ExpandListArgument(wrapper, wrapperFlag);
+  cmExpandList(wrapper, wrapperFlag);
   const std::string wrapperSep(this->Makefile->GetSafeDefinition(
     "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP"));
   bool concatFlagAndArgs = true;
@@ -3504,7 +3498,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
   std::vector<EvaluatedTargetPropertyEntry> entries;
   if (const char* linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
     std::vector<std::string> options;
-    cmSystemTools::ExpandListArgument(linkOptions, options);
+    cmExpandList(linkOptions, options);
     for (const auto& option : options) {
       std::unique_ptr<TargetPropertyEntry> entry(
         CreateTargetPropertyEntry(option));
@@ -3614,7 +3608,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
   const char* debugProp =
     this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugDirectories = !this->DebugLinkDirectoriesDone &&
@@ -3660,7 +3654,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
   std::vector<EvaluatedTargetPropertyEntry> entries;
   if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) {
     std::vector<std::string> depends;
-    cmSystemTools::ExpandListArgument(linkDepends, depends);
+    cmExpandList(linkDepends, depends);
     for (const auto& depend : depends) {
       std::unique_ptr<TargetPropertyEntry> entry(
         CreateTargetPropertyEntry(depend));
@@ -4214,7 +4208,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
   // Process public headers to mark the source files.
   if (const char* files = this->GetProperty("PUBLIC_HEADER")) {
     std::vector<std::string> relFiles;
-    cmSystemTools::ExpandListArgument(files, relFiles);
+    cmExpandList(files, relFiles);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4228,7 +4222,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
   // precedence if a file is listed in both.
   if (const char* files = this->GetProperty("PRIVATE_HEADER")) {
     std::vector<std::string> relFiles;
-    cmSystemTools::ExpandListArgument(files, relFiles);
+    cmExpandList(files, relFiles);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4241,7 +4235,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
   // Mark sources listed as resources.
   if (const char* files = this->GetProperty("RESOURCE")) {
     std::vector<std::string> relFiles;
-    cmSystemTools::ExpandListArgument(files, relFiles);
+    cmExpandList(files, relFiles);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4270,7 +4264,7 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
 #define CM_READ_COMPATIBLE_INTERFACE(X, x)                                    \
   if (const char* prop = li->GetProperty("COMPATIBLE_INTERFACE_" #X)) {       \
     std::vector<std::string> props;                                           \
-    cmSystemTools::ExpandListArgument(prop, props);                           \
+    cmExpandList(prop, props);                                                \
     compat.Props##x.insert(props.begin(), props.end());                       \
   }
       CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool)
@@ -4384,7 +4378,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
   }
 
   std::vector<std::string> props;
-  cmSystemTools::ExpandListArgument(prop, props);
+  cmExpandList(prop, props);
   std::string pdir = cmSystemTools::GetCMakeRoot();
   pdir += "/Help/prop_tgt/";
 
@@ -5115,7 +5109,7 @@ void cmGeneratorTarget::ReportPropertyOrigin(
   const char* debugProp = this->Target->GetMakefile()->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES");
   if (debugProp) {
-    cmSystemTools::ExpandListArgument(debugProp, debugProperties);
+    cmExpandList(debugProp, debugProperties);
   }
 
   bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] &&
@@ -5167,10 +5161,9 @@ void cmGeneratorTarget::ExpandLinkItems(
   }
   std::vector<std::string> libs;
   std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
-  cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
-                                                  false, headTarget, this,
-                                                  &dagChecker),
-                                    libs);
+  cmExpandList(cge->Evaluate(this->LocalGenerator, config, false, headTarget,
+                             this, &dagChecker),
+               libs);
   this->LookupLinkItems(libs, cge->GetBacktrace(), items);
   hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
 }
@@ -5747,12 +5740,12 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
   if (!iface.AllDone) {
     iface.AllDone = true;
     iface.Multiplicity = info->Multiplicity;
-    cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
+    cmExpandList(info->Languages, iface.Languages);
     this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
                           headTarget, usage_requirements_only, iface.Libraries,
                           iface.HadHeadSensitiveCondition);
     std::vector<std::string> deps;
-    cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
+    cmExpandList(info->SharedDeps, deps);
     this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
   }
 
@@ -6041,7 +6034,7 @@ void cmGeneratorTarget::GetObjectLibrariesCMP0026(
   cmStringRange rng = this->Target->GetSourceEntries();
   for (std::string const& entry : rng) {
     std::vector<std::string> files;
-    cmSystemTools::ExpandListArgument(entry, files);
+    cmExpandList(entry, files);
     for (std::string const& li : files) {
       if (cmHasLiteralPrefix(li, "$<TARGET_OBJECTS:") && li.back() == '>') {
         std::string objLibName = li.substr(17, li.size() - 18);
@@ -6255,7 +6248,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
     std::unique_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
     std::string const& evaluated =
       cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
-    cmSystemTools::ExpandListArgument(evaluated, llibs);
+    cmExpandList(evaluated, llibs);
     if (cge->GetHadHeadSensitiveCondition()) {
       impl.HadHeadSensitiveCondition = true;
     }
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 00ebbb5..47c731b 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -469,7 +469,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
   const char* prop = sf->GetProperty(propName);
   if (prop) {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(prop, list);
+    cmExpandList(prop, list);
     for (auto& p : list) {
       fout << "    " << propFlag << p << std::endl;
     }
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4db5ca8..86fcae0 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1149,7 +1149,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
     std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS");
   std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar);
   std::vector<std::string> extensionList;
-  cmSystemTools::ExpandListArgument(ignoreExts, extensionList);
+  cmExpandList(ignoreExts, extensionList);
   for (std::string const& i : extensionList) {
     this->IgnoreExtensions[i] = true;
   }
@@ -1162,7 +1162,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
     std::string("_SOURCE_FILE_EXTENSIONS");
   const std::string& exts = mf->GetSafeDefinition(extensionsVar);
   std::vector<std::string> extensionList;
-  cmSystemTools::ExpandListArgument(exts, extensionList);
+  cmExpandList(exts, extensionList);
   for (std::string const& i : extensionList) {
     this->ExtensionToLanguage[i] = l;
   }
@@ -1622,8 +1622,7 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
       std::string const& standardIncludesStr =
         mf->GetSafeDefinition(standardIncludesVar);
       std::vector<std::string> standardIncludesVec;
-      cmSystemTools::ExpandListArgument(standardIncludesStr,
-                                        standardIncludesVec);
+      cmExpandList(standardIncludesStr, standardIncludesVec);
       standardIncludesSet.insert(standardIncludesVec.begin(),
                                  standardIncludesVec.end());
     }
@@ -1734,7 +1733,7 @@ void cmGlobalGenerator::CheckTargetProperties()
       std::string incDirs = cmGeneratorExpression::Preprocess(
         incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
 
-      cmSystemTools::ExpandListArgument(incDirs, incs);
+      cmExpandList(incDirs, incs);
 
       for (std::string const& incDir : incs) {
         if (incDir.size() > 9 && cmSystemTools::IsNOTFOUND(incDir.c_str())) {
@@ -2977,7 +2976,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
     // List the target-wide labels.  All sources in the target get
     // these labels.
     if (targetLabels) {
-      cmSystemTools::ExpandListArgument(targetLabels, labels);
+      cmExpandList(targetLabels, labels);
       if (!labels.empty()) {
         fout << "# Target labels\n";
         for (std::string const& l : labels) {
@@ -2992,12 +2991,11 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
     std::vector<std::string> cmakeDirectoryLabelsList;
 
     if (directoryLabels) {
-      cmSystemTools::ExpandListArgument(directoryLabels, directoryLabelsList);
+      cmExpandList(directoryLabels, directoryLabelsList);
     }
 
     if (cmakeDirectoryLabels) {
-      cmSystemTools::ExpandListArgument(cmakeDirectoryLabels,
-                                        cmakeDirectoryLabelsList);
+      cmExpandList(cmakeDirectoryLabels, cmakeDirectoryLabelsList);
     }
 
     if (!directoryLabelsList.empty() || !cmakeDirectoryLabelsList.empty()) {
@@ -3034,7 +3032,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
       if (const char* svalue = sf->GetProperty("LABELS")) {
         labels.clear();
         Json::Value& lj_source_labels = lj_source["labels"] = Json::arrayValue;
-        cmSystemTools::ExpandListArgument(svalue, labels);
+        cmExpandList(svalue, labels);
         for (std::string const& label : labels) {
           fout << " " << label << "\n";
           lj_source_labels.append(label);
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 9f3dab7..4db829f 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -625,7 +625,7 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
     this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
   if (nullptr != ghsGpjMacros) {
     std::vector<std::string> expandedList;
-    cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList);
+    cmExpandList(std::string(ghsGpjMacros), expandedList);
     for (std::string const& arg : expandedList) {
       fout << "macro " << arg << std::endl;
     }
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 8e67fad..e0d86ca 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -201,7 +201,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
     if (target.GetProperty("EXTERNAL_MSPROJECT")) {
       if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
                                              cmSystemTools::UpperCase(i))) {
-        cmSystemTools::ExpandListArgument(m, mapConfig);
+        cmExpandList(m, mapConfig);
         if (!mapConfig.empty()) {
           dstConfig = mapConfig[0].c_str();
         }
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index cd1ff61..45b66ae 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -512,8 +512,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
         }
         fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
         std::vector<std::string> keyValuePairs;
-        cmSystemTools::ExpandListArgument(root->GetMakefile()->GetProperty(it),
-                                          keyValuePairs);
+        cmExpandList(root->GetMakefile()->GetProperty(it), keyValuePairs);
         for (std::string const& itPair : keyValuePairs) {
           const std::string::size_type posEqual = itPair.find('=');
           if (posEqual != std::string::npos) {
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index cc6e421..275be96 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -250,7 +250,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
     if (target.GetProperty("EXTERNAL_MSPROJECT")) {
       if (const char* m = target.GetProperty("MAP_IMPORTED_CONFIG_" +
                                              cmSystemTools::UpperCase(i))) {
-        cmSystemTools::ExpandListArgument(m, mapConfig);
+        cmExpandList(m, mapConfig);
         if (!mapConfig.empty()) {
           dstConfig = mapConfig[0].c_str();
         }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index e3cafe3..19e64e4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -882,7 +882,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
   if (extraFileAttributes) {
     // Expand the list of attributes.
     std::vector<std::string> attributes;
-    cmSystemTools::ExpandListArgument(extraFileAttributes, attributes);
+    cmExpandList(extraFileAttributes, attributes);
 
     // Store the attributes.
     for (const auto& attribute : attributes) {
@@ -2482,10 +2482,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
 std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
                                                       cmGeneratorTarget* gtgt)
 {
-  std::vector<std::string> const configVector =
-    cmSystemTools::ExpandedListArgument(
-      this->CurrentMakefile->GetRequiredDefinition(
-        "CMAKE_CONFIGURATION_TYPES"));
+  std::vector<std::string> const configVector = cmExpandedList(
+    this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"));
   cmXCodeObject* configlist =
     this->CreateObject(cmXCodeObject::XCConfigurationList);
   cmXCodeObject* buildConfigurations =
@@ -3223,8 +3221,7 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
   const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
   const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
   if (osxArch && sysroot) {
-    cmSystemTools::ExpandListArgument(std::string(osxArch),
-                                      this->Architectures);
+    cmExpandList(std::string(osxArch), this->Architectures);
   }
 
   if (this->Architectures.empty()) {
@@ -3627,7 +3624,7 @@ void cmGlobalXCodeGenerator::AppendDefines(BuildObjectListOrString& defs,
 
   // Expand the list of definitions.
   std::vector<std::string> defines;
-  cmSystemTools::ExpandListArgument(defines_list, defines);
+  cmExpandList(defines_list, defines);
 
   // Store the definitions in the string.
   this->AppendDefines(defs, defines, dflag);
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 9befb78..7d0ef83 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -15,6 +15,7 @@
 #include "cmMakefile.h"
 #include "cmState.h"
 #include "cmStateSnapshot.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
 #include "cmake.h"
@@ -234,8 +235,7 @@ void cmGraphVizWriter::ReadSettings(
   this->TargetsToIgnoreRegex.clear();
   if (!ignoreTargetsRegexes.empty()) {
     std::vector<std::string> ignoreTargetsRegExVector;
-    cmSystemTools::ExpandListArgument(ignoreTargetsRegexes,
-                                      ignoreTargetsRegExVector);
+    cmExpandList(ignoreTargetsRegexes, ignoreTargetsRegExVector);
     for (std::string const& currentRegexString : ignoreTargetsRegExVector) {
       cmsys::RegularExpression currentRegex;
       if (!currentRegex.compile(currentRegexString)) {
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 7b992d7..e80aa8e 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -8,7 +8,7 @@
 
 #include "cmAlgorithms.h"
 #include "cmIDEFlagTable.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
 
 cmIDEOptions::cmIDEOptions()
 {
@@ -166,7 +166,7 @@ void cmIDEOptions::AddDefines(std::string const& defines)
 {
   if (!defines.empty()) {
     // Expand the list of definitions.
-    cmSystemTools::ExpandListArgument(defines, this->Defines);
+    cmExpandList(defines, this->Defines);
   }
 }
 void cmIDEOptions::AddDefines(const std::vector<std::string>& defines)
@@ -188,7 +188,7 @@ void cmIDEOptions::AddIncludes(std::string const& includes)
 {
   if (!includes.empty()) {
     // Expand the list of includes.
-    cmSystemTools::ExpandListArgument(includes, this->Includes);
+    cmExpandList(includes, this->Includes);
   }
 }
 void cmIDEOptions::AddIncludes(const std::vector<std::string>& includes)
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 76dafd9..51689a2 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -673,7 +673,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       const char* files = target.GetProperty("PRIVATE_HEADER");
       if ((files) && (*files)) {
         std::vector<std::string> relFiles;
-        cmSystemTools::ExpandListArgument(files, relFiles);
+        cmExpandList(files, relFiles);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) {
           return false;
@@ -688,7 +688,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       files = target.GetProperty("PUBLIC_HEADER");
       if ((files) && (*files)) {
         std::vector<std::string> relFiles;
-        cmSystemTools::ExpandListArgument(files, relFiles);
+        cmExpandList(files, relFiles);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) {
           return false;
@@ -703,7 +703,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       files = target.GetProperty("RESOURCE");
       if ((files) && (*files)) {
         std::vector<std::string> relFiles;
-        cmSystemTools::ExpandListArgument(files, relFiles);
+        cmExpandList(files, relFiles);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles)) {
           return false;
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 9357a5c..1d8210c 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -67,8 +67,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
   cmGeneratorExpression ge;
   for (std::string const& d : this->Directories) {
     std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(d);
-    cmSystemTools::ExpandListArgument(
-      cge->Evaluate(this->LocalGenerator, config), dirs);
+    cmExpandList(cge->Evaluate(this->LocalGenerator, config), dirs);
   }
 
   // Make sure all dirs have absolute paths.
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index e8e82cc..c4048d4 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -4,7 +4,7 @@
 
 #include "cmGeneratorExpression.h"
 #include "cmInstallType.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
 
 #include <memory>
 
@@ -85,8 +85,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(
   cmGeneratorExpression ge;
   for (std::string const& f : this->Files) {
     std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(f);
-    cmSystemTools::ExpandListArgument(
-      cge->Evaluate(this->LocalGenerator, config), files);
+    cmExpandList(cge->Evaluate(this->LocalGenerator, config), files);
   }
   this->AddFilesInstallRule(os, config, indent, files);
 }
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 537b4ec..9b481a2 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -5,6 +5,7 @@
 #include "cmAlgorithms.h"
 #include "cmListFileCache.h"
 #include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include <utility>
@@ -107,5 +108,5 @@ void cmInstalledFile::GetPropertyAsList(const std::string& prop,
   this->GetProperty(prop, value);
 
   list.clear();
-  cmSystemTools::ExpandListArgument(value, list);
+  cmExpandList(value, list);
 }
diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx
index 586ea96..d5cc621 100644
--- a/Source/cmLDConfigLDConfigTool.cxx
+++ b/Source/cmLDConfigLDConfigTool.cxx
@@ -4,6 +4,7 @@
 #include "cmLDConfigLDConfigTool.h"
 #include "cmMakefile.h"
 #include "cmRuntimeDependencyArchive.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmUVProcessChain.h"
 
@@ -33,7 +34,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
   }
 
   std::vector<std::string> ldConfigCommand;
-  cmSystemTools::ExpandListArgument(ldConfigPath, ldConfigCommand);
+  cmExpandList(ldConfigPath, ldConfigCommand);
   ldConfigCommand.emplace_back("-v");
   ldConfigCommand.emplace_back("-N"); // Don't rebuild the cache.
   ldConfigCommand.emplace_back("-X"); // Don't update links.
diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx
index 868f564..cbb1d3a 100644
--- a/Source/cmListCommand.cxx
+++ b/Source/cmListCommand.cxx
@@ -119,7 +119,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
     return true;
   }
   // expand the variable into a list
-  cmSystemTools::ExpandListArgument(listString, list, true);
+  cmExpandList(listString, list, true);
   // if no empty elements then just return
   if (std::find(list.begin(), list.end(), std::string()) == list.end()) {
     return true;
@@ -132,7 +132,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
       // ExpandListArgument without the true which will remove
       // empty values
       list.clear();
-      cmSystemTools::ExpandListArgument(listString, list);
+      cmExpandList(listString, list);
       std::string warn = cmPolicies::GetPolicyWarning(cmPolicies::CMP0007);
       warn += " List has value = [";
       warn += listString;
@@ -145,7 +145,7 @@ bool cmListCommand::GetList(std::vector<std::string>& list,
       // ExpandListArgument without the true which will remove
       // empty values
       list.clear();
-      cmSystemTools::ExpandListArgument(listString, list);
+      cmExpandList(listString, list);
       return true;
     case cmPolicies::NEW:
       return true;
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index df0d00c..7ef475a 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -7,6 +7,7 @@
 #include "cmMessenger.h"
 #include "cmState.h"
 #include "cmStateDirectory.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #include <assert.h>
@@ -483,7 +484,7 @@ std::vector<BT<std::string>> ExpandListWithBacktrace(
 {
   std::vector<BT<std::string>> result;
   std::vector<std::string> tmp;
-  cmSystemTools::ExpandListArgument(list, tmp);
+  cmExpandList(list, tmp);
   result.reserve(tmp.size());
   for (std::string& i : tmp) {
     result.emplace_back(std::move(i), bt);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 228495b..c3cfc5f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -311,7 +311,7 @@ void cmLocalGenerator::GenerateTestFiles()
     this->Makefile->GetProperty("TEST_INCLUDE_FILES");
   if (testIncludeFiles) {
     std::vector<std::string> includesList;
-    cmSystemTools::ExpandListArgument(testIncludeFiles, includesList);
+    cmExpandList(testIncludeFiles, includesList);
     for (std::string const& i : includesList) {
       fout << "include(\"" << i << "\")" << std::endl;
     }
@@ -902,7 +902,7 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
         std::string isJMCEnabled = cge->Evaluate(this, config);
         if (cmSystemTools::IsOn(isJMCEnabled)) {
           std::vector<std::string> optVec;
-          cmSystemTools::ExpandListArgument(jmc, optVec);
+          cmExpandList(jmc, optVec);
           this->AppendCompileOptions(flags, optVec);
         }
       }
@@ -955,7 +955,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
   {
     std::string const value = this->Makefile->GetSafeDefinition(
       cmStrCat("CMAKE_", lang, "_STANDARD_INCLUDE_DIRECTORIES"));
-    cmSystemTools::ExpandListArgument(value, userStandardDirs);
+    cmExpandList(value, userStandardDirs);
     for (std::string& usd : userStandardDirs) {
       cmSystemTools::ConvertToUnixSlashes(usd);
     }
@@ -981,7 +981,7 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
         cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"));
       if (value != nullptr) {
         size_t const impDirVecOldSize = impDirVec.size();
-        cmSystemTools::ExpandListArgument(value, impDirVec);
+        cmExpandList(value, impDirVec);
         // FIXME: Use cmRange with 'advance()' when it supports non-const.
         for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
           cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
@@ -1778,7 +1778,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
       if (const char* opt =
             target->Target->GetMakefile()->GetDefinition(option_flag)) {
         std::vector<std::string> optVec;
-        cmSystemTools::ExpandListArgument(opt, optVec);
+        cmExpandList(opt, optVec);
         for (std::string const& i : optVec) {
           this->AppendFlagEscape(flags, i);
         }
@@ -1807,7 +1807,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
       this->IssueMessage(MessageType::FATAL_ERROR, e.str());
     } else {
       std::vector<std::string> optVec;
-      cmSystemTools::ExpandListArgument(opt, optVec);
+      cmExpandList(opt, optVec);
       for (std::string const& i : optVec) {
         this->AppendFlagEscape(flags, i);
       }
@@ -1868,7 +1868,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
     std::string const& opt =
       target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
     std::vector<std::string> optVec;
-    cmSystemTools::ExpandListArgument(opt, optVec);
+    cmExpandList(opt, optVec);
     for (std::string const& i : optVec) {
       this->AppendFlagEscape(flags, i);
     }
@@ -1885,7 +1885,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
     if (const char* opt =
           target->Target->GetMakefile()->GetDefinition(option_flag)) {
       std::vector<std::string> optVec;
-      cmSystemTools::ExpandListArgument(opt, optVec);
+      cmExpandList(opt, optVec);
       for (std::string const& i : optVec) {
         this->AppendFlagEscape(flags, i);
       }
@@ -2081,7 +2081,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
   }
   if (!picFlags.empty()) {
     std::vector<std::string> options;
-    cmSystemTools::ExpandListArgument(picFlags, options);
+    cmExpandList(picFlags, options);
     for (std::string const& o : options) {
       this->AppendFlagEscape(flags, o);
     }
@@ -2153,7 +2153,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
   }
 
   std::vector<std::string> flagsList;
-  cmSystemTools::ExpandListArgument(rawFlagsList, flagsList);
+  cmExpandList(rawFlagsList, flagsList);
   for (std::string const& o : flagsList) {
     this->AppendFlagEscape(flags, o);
   }
@@ -2189,7 +2189,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
   }
 
   std::vector<std::string> flagsList;
-  cmSystemTools::ExpandListArgument(pieFlags, flagsList);
+  cmExpandList(pieFlags, flagsList);
   for (const auto& flag : flagsList) {
     this->AppendFlagEscape(flags, flag);
   }
@@ -2206,7 +2206,7 @@ void cmLocalGenerator::AppendCompileOptions(std::string& options,
 
   // Expand the list of options.
   std::vector<std::string> options_vec;
-  cmSystemTools::ExpandListArgument(options_list, options_vec);
+  cmExpandList(options_list, options_vec);
   this->AppendCompileOptions(options, options_vec, regex);
 }
 
@@ -2241,7 +2241,7 @@ void cmLocalGenerator::AppendIncludeDirectories(
 
   // Expand the list of includes.
   std::vector<std::string> includes_vec;
-  cmSystemTools::ExpandListArgument(includes_list, includes_vec);
+  cmExpandList(includes_list, includes_vec);
   this->AppendIncludeDirectories(includes, includes_vec, sourceFile);
 }
 
@@ -2369,7 +2369,7 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
     cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
   if (optionList != nullptr) {
     std::vector<std::string> options;
-    cmSystemTools::ExpandListArgument(optionList, options);
+    cmExpandList(optionList, options);
     for (std::string const& o : options) {
       this->AppendFlagEscape(flags, o);
     }
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 248f4a6..ec35551 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -25,6 +25,7 @@
 #include "cmSourceFile.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 #include "cmsys/FStream.hxx"
@@ -222,7 +223,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
     cmGlobalNinjaGenerator::WriteComment(
       os, "Pools defined by global property JOB_POOLS");
     std::vector<std::string> pools;
-    cmSystemTools::ExpandListArgument(jobpools, pools);
+    cmExpandList(jobpools, pools);
     for (std::string const& pool : pools) {
       const std::string::size_type eq = pool.find('=');
       unsigned int jobs;
@@ -613,7 +614,7 @@ void cmLocalNinjaGenerator::AdditionalCleanFiles()
     {
       cmGeneratorExpression ge;
       auto cge = ge.Parse(prop_value);
-      cmSystemTools::ExpandListArgument(
+      cmExpandList(
         cge->Evaluate(this,
                       this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
         cleanFiles);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index cfad31a..a089682 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1102,7 +1102,7 @@ void cmLocalUnixMakefileGenerator3::AppendDirectoryCleanCommand(
         this->Makefile->GetProperty("ADDITIONAL_CLEAN_FILES")) {
     cmGeneratorExpression ge;
     std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
-    cmSystemTools::ExpandListArgument(
+    cmExpandList(
       cge->Evaluate(this,
                     this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")),
       cleanFiles);
@@ -1466,8 +1466,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
 
   // for each language we need to scan, scan it
   std::vector<std::string> langs;
-  cmSystemTools::ExpandListArgument(
-    mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs);
+  cmExpandList(mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs);
   for (std::string const& lang : langs) {
     // construct the checker
     // Create the scanner for this language
@@ -1512,7 +1511,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
 
   // Convert the string to a list and preserve empty entries.
   std::vector<std::string> pairs;
-  cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
+  cmExpandList(pairs_string, pairs, true);
   for (std::vector<std::string>::const_iterator i = pairs.begin();
        i != pairs.end() && (i + 1) != pairs.end();) {
     const std::string& depender = *i++;
@@ -1744,7 +1743,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
     return;
   }
   std::vector<std::string> files;
-  cmSystemTools::ExpandListArgument(infoDef, files);
+  cmExpandList(infoDef, files);
 
   // Each depend information file corresponds to a target.  Clear the
   // dependencies for that target.
@@ -1912,11 +1911,11 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
   std::vector<std::string> transformRules;
   if (const char* xform =
         this->Makefile->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
-    cmSystemTools::ExpandListArgument(xform, transformRules);
+    cmExpandList(xform, transformRules);
   }
   if (const char* xform =
         target->GetProperty("IMPLICIT_DEPENDS_INCLUDE_TRANSFORM")) {
-    cmSystemTools::ExpandListArgument(xform, transformRules);
+    cmExpandList(xform, transformRules);
   }
   if (!transformRules.empty()) {
     cmakefileStream << "set(CMAKE_INCLUDE_TRANSFORMS\n";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8154f3e..3d76396 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1526,7 +1526,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
     // Check for extra object-file dependencies.
     if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
       std::vector<std::string> depends;
-      cmSystemTools::ExpandListArgument(deps, depends);
+      cmExpandList(deps, depends);
       const char* sep = "";
       for (std::vector<std::string>::iterator j = depends.begin();
            j != depends.end(); ++j) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index f6f4737..657c3bf 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1349,7 +1349,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
     if (const char* cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
       // Expand the list.
       std::vector<std::string> defs;
-      cmSystemTools::ExpandListArgument(cdefs, defs);
+      cmExpandList(cdefs, defs);
 
       // Recompose the list without the definition.
       std::vector<std::string>::const_iterator defEnd =
@@ -1837,7 +1837,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
       std::vector<std::string> files;
       nvalue = value ? value : "";
 
-      cmSystemTools::ExpandListArgument(nvalue, files);
+      cmExpandList(nvalue, files);
       nvalue.clear();
       for (cc = 0; cc < files.size(); cc++) {
         if (!cmSystemTools::IsOff(files[cc])) {
@@ -1953,7 +1953,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
 
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
     std::vector<std::string> linkLibs;
-    cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+    cmExpandList(linkLibsProp, linkLibs);
 
     for (std::vector<std::string>::iterator j = linkLibs.begin();
          j != linkLibs.end(); ++j) {
@@ -2281,7 +2281,7 @@ void cmMakefile::ExpandVariablesCMP0019()
 
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
     std::vector<std::string> linkLibs;
-    cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+    cmExpandList(linkLibsProp, linkLibs);
 
     for (std::vector<std::string>::iterator l = linkLibs.begin();
          l != linkLibs.end(); ++l) {
@@ -3050,7 +3050,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
   if (this->GetGlobalGenerator()->IsMultiConfig()) {
     if (const char* configTypes =
           this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
-      cmSystemTools::ExpandListArgument(configTypes, configs);
+      cmExpandList(configTypes, configs);
     }
     return "";
   }
@@ -3167,7 +3167,7 @@ bool cmMakefile::ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
     if (i.Delim == cmListFileArgument::Quoted) {
       outArgs.push_back(value);
     } else {
-      cmSystemTools::ExpandListArgument(value, outArgs);
+      cmExpandList(value, outArgs);
     }
   }
   return !cmSystemTools::GetFatalErrorOccured();
@@ -3200,7 +3200,7 @@ bool cmMakefile::ExpandArguments(
       outArgs.emplace_back(value, true);
     } else {
       std::vector<std::string> stringArgs;
-      cmSystemTools::ExpandListArgument(value, stringArgs);
+      cmExpandList(value, stringArgs);
       for (std::string const& stringArg : stringArgs) {
         outArgs.emplace_back(stringArg, false);
       }
@@ -3558,7 +3558,7 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
   const char* cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
   if (cmakeModulePath) {
     std::vector<std::string> modulePath;
-    cmSystemTools::ExpandListArgument(cmakeModulePath, modulePath);
+    cmExpandList(cmakeModulePath, modulePath);
 
     // Look through the possible module directories.
     for (std::string itempl : modulePath) {
@@ -3883,7 +3883,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
 {
   std::vector<std::string> deps;
   if (const char* deps_str = this->GetProperty("CMAKE_CONFIGURE_DEPENDS")) {
-    cmSystemTools::ExpandListArgument(deps_str, deps);
+    cmExpandList(deps_str, deps);
   }
   for (std::string const& dep : deps) {
     if (cmSystemTools::FileIsFullPath(dep)) {
@@ -4378,7 +4378,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
   }
 
   std::vector<std::string> availableFeatures;
-  cmSystemTools::ExpandListArgument(features, availableFeatures);
+  cmExpandList(features, availableFeatures);
   if (std::find(availableFeatures.begin(), availableFeatures.end(), feature) ==
       availableFeatures.end()) {
     std::ostringstream e;
@@ -4648,31 +4648,31 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
   if (const char* propCxx98 =
         this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propCxx98, props);
+    cmExpandList(propCxx98, props);
     needCxx98 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propCxx11 =
         this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propCxx11, props);
+    cmExpandList(propCxx11, props);
     needCxx11 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propCxx14 =
         this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propCxx14, props);
+    cmExpandList(propCxx14, props);
     needCxx14 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propCxx17 =
         this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propCxx17, props);
+    cmExpandList(propCxx17, props);
     needCxx17 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propCxx20 =
         this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propCxx20, props);
+    cmExpandList(propCxx20, props);
     needCxx20 = std::find(props.begin(), props.end(), feature) != props.end();
   }
 }
@@ -4772,19 +4772,19 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
   if (const char* propC90 =
         this->GetDefinition("CMAKE_C90_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propC90, props);
+    cmExpandList(propC90, props);
     needC90 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propC99 =
         this->GetDefinition("CMAKE_C99_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propC99, props);
+    cmExpandList(propC99, props);
     needC99 = std::find(props.begin(), props.end(), feature) != props.end();
   }
   if (const char* propC11 =
         this->GetDefinition("CMAKE_C11_COMPILE_FEATURES")) {
     std::vector<std::string> props;
-    cmSystemTools::ExpandListArgument(propC11, props);
+    cmExpandList(propC11, props);
     needC11 = std::find(props.begin(), props.end(), feature) != props.end();
   }
 }
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 31ee4fa..1335f13 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -165,7 +165,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
   const std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE";
   const std::string linkRule = this->GetLinkRule(linkRuleVar);
   std::vector<std::string> commands1;
-  cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+  cmExpandList(linkRule, real_link_commands);
 
   bool useResponseFileForObjects =
     this->CheckUseResponseFileForObjects(linkLanguage);
@@ -488,7 +488,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     linkLanguage, this->ConfigName);
   std::string linkRule = this->GetLinkRule(linkRuleVar);
   std::vector<std::string> commands1;
-  cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+  cmExpandList(linkRule, real_link_commands);
   if (this->GeneratorTarget->IsExecutableWithExports()) {
     // If a separate rule for creating an import library is specified
     // add it now.
@@ -496,7 +496,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
     implibRuleVar += linkLanguage;
     implibRuleVar += "_CREATE_IMPORT_LIBRARY";
     if (const char* rule = this->Makefile->GetDefinition(implibRuleVar)) {
-      cmSystemTools::ExpandListArgument(rule, real_link_commands);
+      cmExpandList(rule, real_link_commands);
     }
   }
 
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 4621da4..eb0c30c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -370,7 +370,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
     // Construct the main link rule and expand placeholders.
     rulePlaceholderExpander->SetTargetImpLib(targetOutputReal);
     std::string linkRule = this->GetLinkRule(linkRuleVar);
-    cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+    cmExpandList(linkRule, real_link_commands);
 
     // Expand placeholders.
     for (std::string& real_link_command : real_link_commands) {
@@ -650,7 +650,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       arCreateVar, linkLanguage, this->ConfigName);
 
     if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
-      cmSystemTools::ExpandListArgument(rule, archiveCreateCommands);
+      cmExpandList(rule, archiveCreateCommands);
     }
     std::string arAppendVar = "CMAKE_";
     arAppendVar += linkLanguage;
@@ -660,7 +660,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       arAppendVar, linkLanguage, this->ConfigName);
 
     if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
-      cmSystemTools::ExpandListArgument(rule, archiveAppendCommands);
+      cmExpandList(rule, archiveAppendCommands);
     }
     std::string arFinishVar = "CMAKE_";
     arFinishVar += linkLanguage;
@@ -670,7 +670,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
       arFinishVar, linkLanguage, this->ConfigName);
 
     if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
-      cmSystemTools::ExpandListArgument(rule, archiveFinishCommands);
+      cmExpandList(rule, archiveFinishCommands);
     }
   }
 
@@ -880,7 +880,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
     } else {
       // Get the set of commands.
       std::string linkRule = this->GetLinkRule(linkRuleVar);
-      cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
+      cmExpandList(linkRule, real_link_commands);
       if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
           (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) {
         std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat(
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7b26324..6a79615 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -159,10 +159,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
     std::vector<std::string> files;
     cmGeneratorExpression ge;
     std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
-    cmSystemTools::ExpandListArgument(
-      cge->Evaluate(this->LocalGenerator, config, false, this->GeneratorTarget,
-                    nullptr, nullptr),
-      files);
+    cmExpandList(cge->Evaluate(this->LocalGenerator, config, false,
+                               this->GeneratorTarget, nullptr, nullptr),
+                 files);
     return files;
   };
 
@@ -680,12 +679,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
       }
       const std::string& compileRule =
         this->Makefile->GetRequiredDefinition(cmdVar);
-      cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+      cmExpandList(compileRule, compileCommands);
     } else {
       const std::string cmdVar = "CMAKE_" + lang + "_COMPILE_OBJECT";
       const std::string& compileRule =
         this->Makefile->GetRequiredDefinition(cmdVar);
-      cmSystemTools::ExpandListArgument(compileRule, compileCommands);
+      cmExpandList(compileRule, compileCommands);
     }
 
     if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") &&
@@ -783,7 +782,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
     // goes to the beginning of the command line.
     if (!compileCommands.empty() && !compilerLauncher.empty()) {
       std::vector<std::string> args;
-      cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
+      cmExpandList(compilerLauncher, args, true);
       if (!args.empty()) {
         args[0] = this->LocalGenerator->ConvertToOutputFormat(
           args[0], cmOutputConverter::SHELL);
@@ -822,7 +821,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
   std::vector<std::string> outputs(1, relativeObj);
   if (const char* extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) {
     // Register these as extra files to clean.
-    cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
+    cmExpandList(extra_outputs_str, outputs);
     this->CleanFiles.insert(outputs.begin() + 1, outputs.end());
   }
 
@@ -860,7 +859,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
       if (const char* preprocessRule =
             this->Makefile->GetDefinition(preprocessRuleVar)) {
         std::vector<std::string> preprocessCommands;
-        cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands);
+        cmExpandList(preprocessRule, preprocessCommands);
 
         std::string shellObjI = this->LocalGenerator->ConvertToOutputFormat(
           objI, cmOutputConverter::SHELL);
@@ -907,7 +906,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
       if (const char* assemblyRule =
             this->Makefile->GetDefinition(assemblyRuleVar)) {
         std::vector<std::string> assemblyCommands;
-        cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands);
+        cmExpandList(assemblyRule, assemblyCommands);
 
         std::string shellObjS = this->LocalGenerator->ConvertToOutputFormat(
           objS, cmOutputConverter::SHELL);
@@ -1182,7 +1181,7 @@ void cmMakefileTargetGenerator::WriteObjectDependRules(
   // shared between the object file and dependency scanning rule.
   depends.push_back(source.GetFullPath());
   if (const char* objectDeps = source.GetProperty("OBJECT_DEPENDS")) {
-    cmSystemTools::ExpandListArgument(objectDeps, depends);
+    cmExpandList(objectDeps, depends);
   }
 }
 
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 66d3c88..dec32fa 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -104,10 +104,9 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
     // Check if any indentation has requested:
     // `CMAKE_MESSAGE_INDENT` is a list of "padding" pieces
     // to be joined and prepended to the message lines.
-    auto indent =
-      cmJoin(cmSystemTools::ExpandedListArgument(
-               this->Makefile->GetSafeDefinition("CMAKE_MESSAGE_INDENT")),
-             "");
+    auto indent = cmJoin(cmExpandedList(this->Makefile->GetSafeDefinition(
+                           "CMAKE_MESSAGE_INDENT")),
+                         "");
     // Make every line of the `message` indented
     // NOTE Can't reuse `cmDocumentationFormatter::PrintPreformatted`
     // here cuz it appends `\n` to the EOM ;-(
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 865ae7d..4ebeb60 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -440,12 +440,12 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
     case cmStateEnums::MODULE_LIBRARY: {
       const std::string cudaLinkCmd(
         this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
-      cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+      cmExpandList(cudaLinkCmd, linkCmds);
     } break;
     case cmStateEnums::EXECUTABLE: {
       const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition(
         "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
-      cmSystemTools::ExpandListArgument(cudaLinkCmd, linkCmds);
+      cmExpandList(cudaLinkCmd, linkCmds);
     } break;
     default:
       break;
@@ -474,7 +474,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
           linkCmdStr += rule;
         }
       }
-      cmSystemTools::ExpandListArgument(linkCmdStr, linkCmds);
+      cmExpandList(linkCmdStr, linkCmds);
       if (this->GetGeneratorTarget()->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
         std::string cmakeCommand =
           this->GetLocalGenerator()->ConvertToOutputFormat(
@@ -510,7 +510,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
           linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
 
         std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
-        cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
+        cmExpandList(linkCmd, linkCmds);
       }
       {
         std::string linkCmdVar = "CMAKE_";
@@ -521,7 +521,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd()
           linkCmdVar, this->TargetLinkLanguage, this->GetConfigName());
 
         std::string const& linkCmd = mf->GetRequiredDefinition(linkCmdVar);
-        cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
+        cmExpandList(linkCmd, linkCmds);
       }
 #ifdef __APPLE__
       // On macOS ranlib truncates the fractional part of the static archive
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c3459be..64b2bf6 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -548,8 +548,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
       // Lookup the explicit preprocessing rule.
       std::string ppVar = "CMAKE_" + lang;
       ppVar += "_PREPROCESS_SOURCE";
-      cmSystemTools::ExpandListArgument(
-        this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds);
+      cmExpandList(this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds);
     }
 
     for (std::string& i : ppCmds) {
@@ -686,11 +685,11 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
       cmdVar = "CMAKE_CUDA_COMPILE_WHOLE_COMPILATION";
     }
     const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
-    cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+    cmExpandList(compileCmd, compileCmds);
   } else {
     const std::string cmdVar = "CMAKE_" + lang + "_COMPILE_OBJECT";
     const std::string& compileCmd = mf->GetRequiredDefinition(cmdVar);
-    cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+    cmExpandList(compileCmd, compileCmds);
   }
 
   // See if we need to use a compiler launcher like ccache or distcc
@@ -754,7 +753,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
   // goes to the beginning of the command line.
   if (!compileCmds.empty() && !compilerLauncher.empty()) {
     std::vector<std::string> args;
-    cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
+    cmExpandList(compilerLauncher, args, true);
     if (!args.empty()) {
       args[0] = this->LocalGenerator->ConvertToOutputFormat(
         args[0], cmOutputConverter::SHELL);
@@ -998,8 +997,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
   objBuild.ExplicitDeps.push_back(sourceFileName);
 
   if (const char* objectDeps = source->GetProperty("OBJECT_DEPENDS")) {
-    std::vector<std::string> depList =
-      cmSystemTools::ExpandedListArgument(objectDeps);
+    std::vector<std::string> depList = cmExpandedList(objectDeps);
     for (std::string& odi : depList) {
       if (cmSystemTools::FileIsFullPath(odi)) {
         odi = cmSystemTools::CollapseFullPath(odi);
@@ -1152,7 +1150,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
   if (const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
     cmNinjaBuild build("phony");
     build.Comment = "Additional output files.";
-    build.Outputs = cmSystemTools::ExpandedListArgument(objectOutputs);
+    build.Outputs = cmExpandedList(objectOutputs);
     std::transform(build.Outputs.begin(), build.Outputs.end(),
                    build.Outputs.begin(), MapToNinjaPath());
     build.ExplicitDeps = objBuild.Outputs;
@@ -1301,12 +1299,12 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand(
     }
     const std::string& compileCmd =
       this->GetMakefile()->GetRequiredDefinition(cmdVar);
-    cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+    cmExpandList(compileCmd, compileCmds);
   } else {
     const std::string cmdVar = "CMAKE_" + language + "_COMPILE_OBJECT";
     const std::string& compileCmd =
       this->GetMakefile()->GetRequiredDefinition(cmdVar);
-    cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
+    cmExpandList(compileCmd, compileCmds);
   }
 
   std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@@ -1333,11 +1331,10 @@ void cmNinjaTargetGenerator::AdditionalCleanFiles()
     {
       cmGeneratorExpression ge;
       auto cge = ge.Parse(prop_value);
-      cmSystemTools::ExpandListArgument(
-        cge->Evaluate(lg,
-                      this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"),
-                      false, this->GeneratorTarget, nullptr, nullptr),
-        cleanFiles);
+      cmExpandList(cge->Evaluate(
+                     lg, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"),
+                     false, this->GeneratorTarget, nullptr, nullptr),
+                   cleanFiles);
     }
     std::string const& binaryDir = lg->GetCurrentBinaryDirectory();
     cmGlobalNinjaGenerator* gg = lg->GetGlobalNinjaGenerator();
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx
index da7f8bc..bf516e3 100644
--- a/Source/cmOutputConverter.cxx
+++ b/Source/cmOutputConverter.cxx
@@ -9,6 +9,7 @@
 #include <vector>
 
 #include "cmState.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot)
@@ -153,7 +154,7 @@ cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(
 {
   FortranFormat format = FortranFormatNone;
   if (!value.empty()) {
-    for (std::string const& fi : cmSystemTools::ExpandedListArgument(value)) {
+    for (std::string const& fi : cmExpandedList(value)) {
       if (fi == "FIXED") {
         format = FortranFormatFixed;
       }
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index 587e21c..de47ce0 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -123,7 +123,7 @@ public:
         incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
 
       std::vector<std::string> includes;
-      cmSystemTools::ExpandListArgument(incDirs, includes);
+      cmExpandList(incDirs, includes);
 
       for (std::string& path : includes) {
         this->Makefile->ExpandVariablesInString(path);
diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx
index 04fa0fb..0e1b94e 100644
--- a/Source/cmParseArgumentsCommand.cxx
+++ b/Source/cmParseArgumentsCommand.cxx
@@ -161,17 +161,17 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args,
 
   // the second argument is a (cmake) list of options without argument
   std::vector<std::string> list;
-  cmSystemTools::ExpandListArgument(*argIter++, list);
+  cmExpandList(*argIter++, list);
   parser.Bind(list, options, duplicateKey);
 
   // the third argument is a (cmake) list of single argument options
   list.clear();
-  cmSystemTools::ExpandListArgument(*argIter++, list);
+  cmExpandList(*argIter++, list);
   parser.Bind(list, singleValArgs, duplicateKey);
 
   // the fourth argument is a (cmake) list of multi argument options
   list.clear();
-  cmSystemTools::ExpandListArgument(*argIter++, list);
+  cmExpandList(*argIter++, list);
   parser.Bind(list, multiValArgs, duplicateKey);
 
   list.clear();
@@ -179,7 +179,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args,
     // Flatten ;-lists in the arguments into a single list as was done
     // by the original function(CMAKE_PARSE_ARGUMENTS).
     for (; argIter != argEnd; ++argIter) {
-      cmSystemTools::ExpandListArgument(*argIter, list);
+      cmExpandList(*argIter, list);
     }
   } else {
     // in the PARSE_ARGV move read the arguments from ARGC and ARGV#
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 360df25..f9b76cd 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -392,7 +392,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
       if (!deps.empty()) {
         std::vector<std::string> extraDeps;
-        cmSystemTools::ExpandListArgument(deps, extraDeps);
+        cmExpandList(deps, extraDeps);
         for (std::string const& depName : extraDeps) {
           // Allow target and file dependencies
           auto* depTarget = makefile->FindTargetToUse(depName);
@@ -543,7 +543,7 @@ bool cmQtAutoGenInitializer::InitUic()
     std::string const usp =
       this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS");
     if (!usp.empty()) {
-      cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths);
+      cmExpandList(usp, this->Uic.SearchPaths);
       std::string const& srcDir = makefile->GetCurrentSourceDirectory();
       for (std::string& path : this->Uic.SearchPaths) {
         path = cmSystemTools::CollapseFullPath(path, srcDir);
@@ -689,7 +689,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
           {
             std::string const opts = sf->GetSafeProperty(kw.AUTORCC_OPTIONS);
             if (!opts.empty()) {
-              cmSystemTools::ExpandListArgument(opts, qrc.Options);
+              cmExpandList(opts, qrc.Options);
             }
           }
           this->Rcc.Qrcs.push_back(std::move(qrc));
@@ -808,7 +808,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
           if (!uicOpts.empty()) {
             this->Uic.FileFiles.push_back(std::move(realPath));
             std::vector<std::string> optsVec;
-            cmSystemTools::ExpandListArgument(uicOpts, optsVec);
+            cmExpandList(uicOpts, optsVec);
             this->Uic.FileOptions.push_back(std::move(optsVec));
           }
         } else {
@@ -862,8 +862,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
     const bool modernQt = (this->QtVersion.Major >= 5);
     // Target rcc options
     std::vector<std::string> optionsTarget;
-    cmSystemTools::ExpandListArgument(
-      this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS), optionsTarget);
+    cmExpandList(this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS),
+                 optionsTarget);
 
     // Check if file name is unique
     for (Qrc& qrc : this->Rcc.Qrcs) {
diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx
index e693816..38e259b 100644
--- a/Source/cmQtAutoMocUic.cxx
+++ b/Source/cmQtAutoMocUic.cxx
@@ -1511,7 +1511,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
   };
   auto InfoGetList = [makefile](const char* key) -> std::vector<std::string> {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+    cmExpandList(makefile->GetSafeDefinition(key), list);
     return list;
   };
   auto InfoGetLists =
@@ -1528,8 +1528,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
         if (length >= 2) {
           std::string::const_iterator itBeg = value.begin() + (pos + 1);
           std::string::const_iterator itEnd = itBeg + (length - 2);
-          lists.emplace_back(
-            cmSystemTools::ExpandedListArgument(std::string(itBeg, itEnd)));
+          lists.emplace_back(cmExpandedList(std::string(itBeg, itEnd)));
         }
         pos += length;
         pos += ListSep.size();
@@ -1551,7 +1550,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
   auto InfoGetConfigList =
     [&InfoGetConfig](const char* key) -> std::vector<std::string> {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+    cmExpandList(InfoGetConfig(key), list);
     return list;
   };
   auto LogInfoError = [this](std::string const& msg) -> bool {
diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx
index c75b2ca..ea3cad9 100644
--- a/Source/cmQtAutoRcc.cxx
+++ b/Source/cmQtAutoRcc.cxx
@@ -29,7 +29,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   auto InfoGetList =
     [makefile](std::string const& key) -> std::vector<std::string> {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition(key), list);
+    cmExpandList(makefile->GetSafeDefinition(key), list);
     return list;
   };
   auto InfoGetConfig = [makefile,
@@ -47,7 +47,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   auto InfoGetConfigList =
     [&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
     std::vector<std::string> list;
-    cmSystemTools::ExpandListArgument(InfoGetConfig(key), list);
+    cmExpandList(InfoGetConfig(key), list);
     return list;
   };
   auto LogInfoError = [this](std::string const& msg) -> bool {
diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx
index d0ee4d4..4ba21fa 100644
--- a/Source/cmRemoveCommand.cxx
+++ b/Source/cmRemoveCommand.cxx
@@ -3,7 +3,7 @@
 #include "cmRemoveCommand.h"
 
 #include "cmMakefile.h"
-#include "cmSystemTools.h"
+#include "cmStringAlgorithms.h"
 
 class cmExecutionStatus;
 
@@ -25,13 +25,12 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args,
   }
 
   // expand the variable
-  std::vector<std::string> const varArgsExpanded =
-    cmSystemTools::ExpandedListArgument(cacheValue);
+  std::vector<std::string> const varArgsExpanded = cmExpandedList(cacheValue);
 
   // expand the args
   // check for REMOVE(VAR v1 v2 ... vn)
   std::vector<std::string> const argsExpanded =
-    cmSystemTools::ExpandedLists(args.begin() + 1, args.end());
+    cmExpandedLists(args.begin() + 1, args.end());
 
   // now create the new value
   std::string value;
diff --git a/Source/cmRuntimeDependencyArchive.cxx b/Source/cmRuntimeDependencyArchive.cxx
index 37a87e5..1b3f387 100644
--- a/Source/cmRuntimeDependencyArchive.cxx
+++ b/Source/cmRuntimeDependencyArchive.cxx
@@ -9,6 +9,7 @@
 #include "cmExecutionStatus.h"
 #include "cmMakefile.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 
 #if defined(_WIN32)
@@ -217,7 +218,7 @@ bool cmRuntimeDependencyArchive::GetGetRuntimeDependenciesCommand(
   std::string toolCommand = this->GetMakefile()->GetSafeDefinition(
     "CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND");
   if (!toolCommand.empty()) {
-    cmSystemTools::ExpandListArgument(toolCommand, command);
+    cmExpandList(toolCommand, command);
     return true;
   }
 
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx
index 879cc95..affff54 100644
--- a/Source/cmSearchPath.cxx
+++ b/Source/cmSearchPath.cxx
@@ -79,7 +79,7 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
   // Get a path from a CMake variable.
   if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
     std::vector<std::string> expanded;
-    cmSystemTools::ExpandListArgument(value, expanded);
+    cmExpandList(value, expanded);
 
     for (std::string const& p : expanded) {
       this->AddPathInternal(
@@ -104,7 +104,7 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
   // Get a path from a CMake variable.
   if (const char* value = this->FC->Makefile->GetDefinition(variable)) {
     std::vector<std::string> expanded;
-    cmSystemTools::ExpandListArgument(value, expanded);
+    cmExpandList(value, expanded);
 
     this->AddPrefixPaths(
       expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 4f76b00..99610eb 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -46,7 +46,7 @@ public:
                           std::vector<std::string>& argsOut)
   {
     for (; first != last; ++first) {
-      cmSystemTools::ExpandListArgument(*first, argsOut);
+      cmExpandList(*first, argsOut);
     }
   }
 
@@ -66,7 +66,7 @@ public:
   {
     std::vector<std::string> argsOut;
     for (; first != last; ++first) {
-      cmSystemTools::ExpandListArgument(*first, argsOut);
+      ExpandListArgument(*first, argsOut);
     }
     return argsOut;
   }
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index bf2419a..61b8702 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -89,7 +89,7 @@ const char* cmTargetPropertyComputer::GetSources<cmTarget>(
   const char* sep = "";
   for (std::string const& entry : entries) {
     std::vector<std::string> files;
-    cmSystemTools::ExpandListArgument(entry, files);
+    cmExpandList(entry, files);
     for (std::string const& file : files) {
       if (cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
           file.back() == '>') {
@@ -501,7 +501,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
       const std::string genName = mf->GetGlobalGenerator()->GetName();
       if (cmHasLiteralPrefix(genName, "Visual Studio")) {
         std::vector<std::string> props;
-        cmSystemTools::ExpandListArgument(globals, props);
+        cmExpandList(globals, props);
         const std::string vsGlobal = "VS_GLOBAL_";
         for (const std::string& i : props) {
           // split NAME=VALUE
@@ -744,7 +744,7 @@ public:
   bool operator()(std::string const& entry)
   {
     std::vector<std::string> files;
-    cmSystemTools::ExpandListArgument(entry, files);
+    cmExpandList(entry, files);
     std::vector<cmSourceFileLocation> locations;
     locations.reserve(files.size());
     std::transform(files.begin(), files.end(), std::back_inserter(locations),
@@ -1899,7 +1899,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
     std::string mapProp = "MAP_IMPORTED_CONFIG_";
     mapProp += config_upper;
     if (const char* mapValue = this->GetProperty(mapProp)) {
-      cmSystemTools::ExpandListArgument(mapValue, mappedConfigs, true);
+      cmExpandList(mapValue, mappedConfigs, true);
     }
   }
 
@@ -1986,7 +1986,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config,
   if (!*loc && !*imp) {
     std::vector<std::string> availableConfigs;
     if (const char* iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
-      cmSystemTools::ExpandListArgument(iconfigs, availableConfigs);
+      cmExpandList(iconfigs, availableConfigs);
     }
     for (std::vector<std::string>::const_iterator aci =
            availableConfigs.begin();
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 916784c..75cb413 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -15,6 +15,7 @@
 #include "cmPropertyMap.h"
 #include "cmRange.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmTest.h"
 
@@ -83,7 +84,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
 
   // Expand arguments if COMMAND_EXPAND_LISTS is set
   if (this->Test->GetCommandExpandLists()) {
-    argv = cmSystemTools::ExpandedLists(argv.begin(), argv.end());
+    argv = cmExpandedLists(argv.begin(), argv.end());
     // Expanding lists on an empty command may have left it empty
     if (argv.empty()) {
       argv.emplace_back();
@@ -102,7 +103,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
     const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
     if (emulator != nullptr && *emulator) {
       std::vector<std::string> emulatorWithArgs;
-      cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+      cmExpandList(emulator, emulatorWithArgs);
       std::string emulatorExe(emulatorWithArgs[0]);
       cmSystemTools::ConvertToUnixSlashes(emulatorExe);
       os << cmOutputConverter::EscapeForCMake(emulatorExe) << " ";
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index ed944ac..5cc4795 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -11,6 +11,7 @@
 #include "cmRange.h"
 #include "cmState.h"
 #include "cmStateTypes.h"
+#include "cmStringAlgorithms.h"
 #include "cmSystemTools.h"
 #include "cmake.h"
 
@@ -170,7 +171,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
     this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
   if (!emulator.empty()) {
     std::vector<std::string> emulatorWithArgs;
-    cmSystemTools::ExpandListArgument(emulator, emulatorWithArgs);
+    cmExpandList(emulator, emulatorWithArgs);
     finalCommand +=
       cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
     finalCommand += " ";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed6e4d9..0e4b0af 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -750,7 +750,7 @@ void cmVisualStudio10TargetGenerator::WritePackageReferences(Elem& e0)
   std::vector<std::string> packageReferences;
   if (const char* vsPackageReferences =
         this->GeneratorTarget->GetProperty("VS_PACKAGE_REFERENCES")) {
-    cmSystemTools::ExpandListArgument(vsPackageReferences, packageReferences);
+    cmExpandList(vsPackageReferences, packageReferences);
   }
   if (!packageReferences.empty()) {
     Elem e1(e0, "ItemGroup");
@@ -777,7 +777,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences(Elem& e0)
   std::vector<std::string> references;
   if (const char* vsDotNetReferences =
         this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES")) {
-    cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
+    cmExpandList(vsDotNetReferences, references);
   }
   cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
   for (auto const& i : props.GetList()) {
@@ -854,7 +854,7 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0)
     this->GeneratorTarget->Target->GetProperty("VS_PROJECT_IMPORT");
   if (imports) {
     std::vector<std::string> argsSplit;
-    cmSystemTools::ExpandListArgument(std::string(imports), argsSplit, false);
+    cmExpandList(std::string(imports), argsSplit, false);
     for (auto& path : argsSplit) {
       if (!cmsys::SystemTools::FileIsFullPath(path)) {
         path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;
@@ -1074,7 +1074,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences(Elem& e0)
   std::vector<std::string> references;
   if (const char* vsWinRTReferences =
         this->GeneratorTarget->GetProperty("VS_WINRT_REFERENCES")) {
-    cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
+    cmExpandList(vsWinRTReferences, references);
   }
 
   if (this->GlobalGenerator->TargetsWindowsPhone() &&
@@ -4027,7 +4027,7 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0)
   std::unique_ptr<Elem> spe1;
   if (const char* vsSDKReferences =
         this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) {
-    cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences);
+    cmExpandList(vsSDKReferences, sdkReferences);
     spe1 = cm::make_unique<Elem>(e0, "ItemGroup");
     for (std::string const& ri : sdkReferences) {
       Elem(*spe1, "SDKReference").Attribute("Include", ri);
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index c33bb7e..a565a9c 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -218,7 +218,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
   if (const char* argList =
         this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ARGUMENTS")) {
     std::vector<std::string> arguments;
-    cmSystemTools::ExpandListArgument(argList, arguments);
+    cmExpandList(argList, arguments);
     if (!arguments.empty()) {
       xout.StartElement("CommandLineArguments");
 
@@ -239,7 +239,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
   if (const char* envList =
         this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ENVIRONMENT")) {
     std::vector<std::string> envs;
-    cmSystemTools::ExpandListArgument(envList, envs);
+    cmExpandList(envList, envs);
     if (!envs.empty()) {
       xout.StartElement("EnvironmentVariables");
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index af73c8d..440a7b1 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -530,7 +530,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
   } else if (mode == "COMPILE") {
     std::string includes = mf->GetSafeDefinition("PACKAGE_INCLUDE_DIRS");
     std::vector<std::string> includeDirs;
-    cmSystemTools::ExpandListArgument(includes, includeDirs);
+    cmExpandList(includes, includeDirs);
 
     gg->CreateGenerationObjects();
     cmLocalGenerator* lg = gg->LocalGenerators[0];
@@ -547,7 +547,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
 
     std::string libs = mf->GetSafeDefinition("PACKAGE_LIBRARIES");
     std::vector<std::string> libList;
-    cmSystemTools::ExpandListArgument(libs, libList);
+    cmExpandList(libs, libList);
     for (std::string const& lib : libList) {
       tgt->AddLinkLibrary(*mf, lib, GENERAL_LibraryType);
     }
@@ -1251,7 +1251,7 @@ struct SaveCacheEntry
 int cmake::HandleDeleteCacheVariables(const std::string& var)
 {
   std::vector<std::string> argsSplit;
-  cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true);
+  cmExpandList(std::string(var), argsSplit, true);
   // erase the property to avoid infinite recursion
   this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
   if (this->State->GetIsInTryCompile()) {
@@ -2159,7 +2159,7 @@ int cmake::CheckBuildSystem()
   // If any byproduct of makefile generation is missing we must re-run.
   std::vector<std::string> products;
   if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) {
-    cmSystemTools::ExpandListArgument(productStr, products);
+    cmExpandList(productStr, products);
   }
   for (std::string const& p : products) {
     if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) {
@@ -2178,8 +2178,8 @@ int cmake::CheckBuildSystem()
   const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS");
   const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS");
   if (dependsStr && outputsStr) {
-    cmSystemTools::ExpandListArgument(dependsStr, depends);
-    cmSystemTools::ExpandListArgument(outputsStr, outputs);
+    cmExpandList(dependsStr, depends);
+    cmExpandList(outputsStr, outputs);
   }
   if (depends.empty() || outputs.empty()) {
     // Not enough information was provided to do the test.  Just rerun.
@@ -2555,7 +2555,7 @@ std::vector<std::string> cmake::GetDebugConfigs()
   if (const char* config_list =
         this->State->GetGlobalProperty("DEBUG_CONFIGURATIONS")) {
     // Expand the specified list and convert to upper-case.
-    cmSystemTools::ExpandListArgument(config_list, configs);
+    cmExpandList(config_list, configs);
     std::transform(configs.begin(), configs.end(), configs.begin(),
                    cmSystemTools::UpperCase);
   }
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 69d5fcd..ba2788e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -175,7 +175,7 @@ static int HandleIWYU(const std::string& runCmd,
   // Construct the iwyu command line by taking what was given
   // and adding all the arguments we give to the compiler.
   std::vector<std::string> iwyu_cmd;
-  cmSystemTools::ExpandListArgument(runCmd, iwyu_cmd, true);
+  cmExpandList(runCmd, iwyu_cmd, true);
   cmAppend(iwyu_cmd, orig_cmd.begin() + 1, orig_cmd.end());
   // Run the iwyu command line.  Capture its stderr and hide its stdout.
   // Ignore its return code because the tool always returns non-zero.
@@ -204,8 +204,7 @@ static int HandleTidy(const std::string& runCmd, const std::string& sourceFile,
   // automatically skip over the compiler itself and extract the
   // options.
   int ret;
-  std::vector<std::string> tidy_cmd =
-    cmSystemTools::ExpandedListArgument(runCmd, true);
+  std::vector<std::string> tidy_cmd = cmExpandedList(runCmd, true);
   tidy_cmd.push_back(sourceFile);
   tidy_cmd.emplace_back("--");
   cmAppend(tidy_cmd, orig_cmd);
@@ -266,7 +265,7 @@ static int HandleCppLint(const std::string& runCmd,
 {
   // Construct the cpplint command line.
   std::vector<std::string> cpplint_cmd;
-  cmSystemTools::ExpandListArgument(runCmd, cpplint_cmd, true);
+  cmExpandList(runCmd, cpplint_cmd, true);
   cpplint_cmd.push_back(sourceFile);
 
   // Run the cpplint command line.  Capture its output.
@@ -295,7 +294,7 @@ static int HandleCppCheck(const std::string& runCmd,
 {
   // Construct the cpplint command line.
   std::vector<std::string> cppcheck_cmd;
-  cmSystemTools::ExpandListArgument(runCmd, cppcheck_cmd, true);
+  cmExpandList(runCmd, cppcheck_cmd, true);
   // extract all the -D, -U, and -I options from the compile line
   for (auto const& opt : orig_cmd) {
     if (opt.size() > 2) {
@@ -408,7 +407,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string> const& args)
         if (cmHasLiteralPrefix(arg, "--source=")) {
           sourceFile = arg.substr(9);
         } else if (cmHasLiteralPrefix(arg, "--launcher=")) {
-          cmSystemTools::ExpandListArgument(arg.substr(11), launchers, true);
+          cmExpandList(arg.substr(11), launchers, true);
         } else {
           // if it was not a co-compiler or --source/--launcher then error
           std::cerr << "__run_co_compile given unknown argument: " << arg
-- 
cgit v0.12


From 2f6495e24e57cd4a03f38e615cc60177e89afb96 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann <sebholt@xwmw.org>
Date: Sun, 11 Aug 2019 12:06:19 +0200
Subject: cmSystemTools: Remove ExpandListArgument methods

---
 Source/cmSystemTools.cxx | 73 ------------------------------------------------
 Source/cmSystemTools.h   | 43 ----------------------------
 2 files changed, 116 deletions(-)

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index ee60f16..7d9b3b9 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1089,79 +1089,6 @@ void cmSystemTools::GlobDirs(const std::string& path,
   }
 }
 
-void cmSystemTools::ExpandListArgument(cm::string_view arg,
-                                       std::vector<std::string>& argsOut,
-                                       bool emptyArgs)
-{
-  // If argument is empty, it is an empty list.
-  if (!emptyArgs && arg.empty()) {
-    return;
-  }
-
-  // if there are no ; in the name then just copy the current string
-  if (arg.find(';') == cm::string_view::npos) {
-    argsOut.emplace_back(arg);
-    return;
-  }
-
-  std::string newArg;
-  // Break the string at non-escaped semicolons not nested in [].
-  int squareNesting = 0;
-  cm::string_view::iterator last = arg.begin();
-  cm::string_view::iterator const cend = arg.end();
-  for (cm::string_view::iterator c = last; c != cend; ++c) {
-    switch (*c) {
-      case '\\': {
-        // We only want to allow escaping of semicolons.  Other
-        // escapes should not be processed here.
-        cm::string_view::iterator cnext = c + 1;
-        if ((cnext != cend) && *cnext == ';') {
-          newArg.append(last, c);
-          // Skip over the escape character
-          last = cnext;
-          c = cnext;
-        }
-      } break;
-      case '[': {
-        ++squareNesting;
-      } break;
-      case ']': {
-        --squareNesting;
-      } break;
-      case ';': {
-        // Break the string here if we are not nested inside square
-        // brackets.
-        if (squareNesting == 0) {
-          newArg.append(last, c);
-          // Skip over the semicolon
-          last = c + 1;
-          if (!newArg.empty() || emptyArgs) {
-            // Add the last argument if the string is not empty.
-            argsOut.push_back(newArg);
-            newArg.clear();
-          }
-        }
-      } break;
-      default: {
-        // Just append this character.
-      } break;
-    }
-  }
-  newArg.append(last, cend);
-  if (!newArg.empty() || emptyArgs) {
-    // Add the last argument if the string is not empty.
-    argsOut.push_back(std::move(newArg));
-  }
-}
-
-std::vector<std::string> cmSystemTools::ExpandedListArgument(
-  cm::string_view arg, bool emptyArgs)
-{
-  std::vector<std::string> argsOut;
-  ExpandListArgument(arg, argsOut, emptyArgs);
-  return argsOut;
-}
-
 bool cmSystemTools::SimpleGlob(const std::string& glob,
                                std::vector<std::string>& files,
                                int type /* = 0 */)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 99610eb..c713783 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -29,49 +29,6 @@ public:
   typedef cmProcessOutput::Encoding Encoding;
 
   /**
-   * Expand the ; separated string @a arg into multiple arguments.
-   * All found arguments are appended to @a argsOut.
-   */
-  static void ExpandListArgument(cm::string_view arg,
-                                 std::vector<std::string>& argsOut,
-                                 bool emptyArgs = false);
-
-  /**
-   * Expand out any arguments in the string range [@a first, @a last) that have
-   * ; separated strings into multiple arguments.  All found arguments are
-   * appended to @a argsOut.
-   */
-  template <class InputIt>
-  static void ExpandLists(InputIt first, InputIt last,
-                          std::vector<std::string>& argsOut)
-  {
-    for (; first != last; ++first) {
-      cmExpandList(*first, argsOut);
-    }
-  }
-
-  /**
-   * Same as ExpandListArgument but a new vector is created containing
-   * the expanded arguments from the string @a arg.
-   */
-  static std::vector<std::string> ExpandedListArgument(cm::string_view arg,
-                                                       bool emptyArgs = false);
-
-  /**
-   * Same as ExpandList but a new vector is created containing the expanded
-   * versions of all arguments in the string range [@a first, @a last).
-   */
-  template <class InputIt>
-  static std::vector<std::string> ExpandedLists(InputIt first, InputIt last)
-  {
-    std::vector<std::string> argsOut;
-    for (; first != last; ++first) {
-      ExpandListArgument(*first, argsOut);
-    }
-    return argsOut;
-  }
-
-  /**
    * Look for and replace registry values in a string
    */
   static void ExpandRegistryValues(std::string& source,
-- 
cgit v0.12