Przeglądaj źródła

Source sweep: Replace cmExpandList with the shorter cmExpandedList

This replaces the code pattern
```
std::vector<std::string> args;
cmExpandList(valueStr, args, ...)
```
with
```
std::vector<std::string> args = cmExpandedList(valueStr, ...)
```
Sebastian Holtermann 6 lat temu
rodzic
commit
aaf59120bf
62 zmienionych plików z 186 dodań i 318 usunięć
  1. 2 4
      Source/CPack/IFW/cmCPackIFWCommon.cxx
  2. 1 2
      Source/CPack/IFW/cmCPackIFWGenerator.cxx
  3. 1 2
      Source/CPack/IFW/cmCPackIFWPackage.cxx
  4. 5 9
      Source/CPack/WiX/cmCPackWIXGenerator.cxx
  5. 1 2
      Source/CPack/cmCPackBundleGenerator.cxx
  6. 1 2
      Source/CPack/cmCPackDebGenerator.cxx
  7. 2 2
      Source/CPack/cmCPackDragNDropGenerator.cxx
  8. 6 6
      Source/CPack/cmCPackFreeBSDGenerator.cxx
  9. 16 18
      Source/CPack/cmCPackGenerator.cxx
  10. 4 4
      Source/CPack/cmCPackNSISGenerator.cxx
  11. 2 2
      Source/CPack/cmCPackOSXX11Generator.cxx
  12. 1 2
      Source/CPack/cpack.cxx
  13. 1 2
      Source/CTest/cmCTestGIT.cxx
  14. 1 2
      Source/CTest/cmCTestP4.cxx
  15. 3 6
      Source/CTest/cmCTestScriptHandler.cxx
  16. 2 4
      Source/CTest/cmCTestSubmitCommand.cxx
  17. 2 4
      Source/CTest/cmCTestSubmitHandler.cxx
  18. 11 22
      Source/CTest/cmCTestTestHandler.cxx
  19. 1 2
      Source/CursesDialog/cmCursesCacheEntryComposite.cxx
  20. 2 4
      Source/cmCTest.cxx
  21. 1 2
      Source/cmCacheManager.cxx
  22. 1 2
      Source/cmComputeLinkDepends.cxx
  23. 5 10
      Source/cmComputeLinkInformation.cxx
  24. 1 2
      Source/cmConditionEvaluator.cxx
  25. 1 2
      Source/cmCoreTryCompile.cxx
  26. 3 4
      Source/cmExportBuildAndroidMKGenerator.cxx
  27. 1 2
      Source/cmExportFileGenerator.cxx
  28. 1 2
      Source/cmExportTryCompileFileGenerator.cxx
  29. 5 10
      Source/cmExtraEclipseCDT4Generator.cxx
  30. 1 2
      Source/cmExtraSublimeTextGenerator.cxx
  31. 2 2
      Source/cmFileCopier.cxx
  32. 3 6
      Source/cmGeneratorExpressionNode.cxx
  33. 11 22
      Source/cmGeneratorTarget.cxx
  34. 1 2
      Source/cmGhsMultiTargetGenerator.cxx
  35. 4 6
      Source/cmGlobalGenerator.cxx
  36. 2 2
      Source/cmGlobalGhsMultiGenerator.cxx
  37. 2 2
      Source/cmGlobalVisualStudio7Generator.cxx
  38. 2 4
      Source/cmGlobalXCodeGenerator.cxx
  39. 2 2
      Source/cmGraphVizWriter.cxx
  40. 3 6
      Source/cmInstallCommand.cxx
  41. 1 2
      Source/cmLDConfigLDConfigTool.cxx
  42. 1 2
      Source/cmListFileCache.cxx
  43. 12 24
      Source/cmLocalGenerator.cxx
  44. 1 2
      Source/cmLocalNinjaGenerator.cxx
  45. 4 6
      Source/cmLocalUnixMakefileGenerator3.cxx
  46. 1 2
      Source/cmLocalVisualStudio7Generator.cxx
  47. 14 28
      Source/cmMakefile.cxx
  48. 5 6
      Source/cmMakefileTargetGenerator.cxx
  49. 1 2
      Source/cmNinjaTargetGenerator.cxx
  50. 1 2
      Source/cmOutputRequiredFilesCommand.cxx
  51. 1 2
      Source/cmParseArgumentsCommand.cxx
  52. 4 7
      Source/cmQtAutoGenInitializer.cxx
  53. 3 4
      Source/cmQtAutoMocUic.cxx
  54. 3 4
      Source/cmQtAutoRcc.cxx
  55. 2 4
      Source/cmSearchPath.cxx
  56. 3 6
      Source/cmTarget.cxx
  57. 1 2
      Source/cmTestGenerator.cxx
  58. 1 2
      Source/cmTryRunCommand.cxx
  59. 2 2
      Source/cmVisualStudio10TargetGenerator.cxx
  60. 2 4
      Source/cmXCodeScheme.cxx
  61. 3 6
      Source/cmake.cxx
  62. 3 6
      Source/cmcmd.cxx

+ 2 - 4
Source/CPack/IFW/cmCPackIFWCommon.cxx

@@ -78,8 +78,7 @@ bool cmCPackIFWCommon::IsVersionEqual(const char* version)
 void cmCPackIFWCommon::ExpandListArgument(
   const std::string& arg, std::map<std::string, std::string>& argsOut)
 {
-  std::vector<std::string> args;
-  cmExpandList(arg, args, false);
+  std::vector<std::string> args = cmExpandedList(arg, false);
   if (args.empty()) {
     return;
   }
@@ -100,8 +99,7 @@ void cmCPackIFWCommon::ExpandListArgument(
 void cmCPackIFWCommon::ExpandListArgument(
   const std::string& arg, std::multimap<std::string, std::string>& argsOut)
 {
-  std::vector<std::string> args;
-  cmExpandList(arg, args, false);
+  std::vector<std::string> args = cmExpandedList(arg, false);
   if (args.empty()) {
     return;
   }

+ 1 - 2
Source/CPack/IFW/cmCPackIFWGenerator.cxx

@@ -316,8 +316,7 @@ int cmCPackIFWGenerator::InitializeInternal()
 
   // Repositories
   if (const char* RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL")) {
-    std::vector<std::string> RepoAllVector;
-    cmExpandList(RepoAllStr, RepoAllVector);
+    std::vector<std::string> RepoAllVector = cmExpandedList(RepoAllStr);
     for (std::string const& r : RepoAllVector) {
       this->GetRepository(r);
     }

+ 1 - 2
Source/CPack/IFW/cmCPackIFWPackage.cxx

@@ -431,8 +431,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix)
   if (this->IsSetToEmpty(option)) {
     this->AlienAutoDependOn.clear();
   } else if (const char* value = this->GetOption(option)) {
-    std::vector<std::string> depsOn;
-    cmExpandList(value, depsOn);
+    std::vector<std::string> depsOn = cmExpandedList(value);
     for (std::string const& d : depsOn) {
       DependenceStruct dep(d);
       if (this->Generator->Packages.count(dep.Name)) {

+ 5 - 9
Source/CPack/WiX/cmCPackWIXGenerator.cxx

@@ -228,8 +228,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
 
   const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
   if (patchFilePath) {
-    std::vector<std::string> patchFilePaths;
-    cmExpandList(patchFilePath, patchFilePaths);
+    std::vector<std::string> patchFilePaths = cmExpandedList(patchFilePath);
 
     for (std::string const& p : patchFilePaths) {
       if (!this->Patch->LoadFragments(p)) {
@@ -312,9 +311,8 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream)
   if (!cpackWixExtraObjects)
     return;
 
-  std::vector<std::string> expandedExtraObjects;
-
-  cmExpandList(cpackWixExtraObjects, expandedExtraObjects);
+  std::vector<std::string> expandedExtraObjects =
+    cmExpandedList(cpackWixExtraObjects);
 
   for (std::string const& obj : expandedExtraObjects) {
     stream << " " << QuotePath(obj);
@@ -1131,8 +1129,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
   if (!variableContent)
     return;
 
-  std::vector<std::string> list;
-  cmExpandList(variableContent, list);
+  std::vector<std::string> list = cmExpandedList(variableContent);
   extensions.insert(list.begin(), list.end());
 }
 
@@ -1143,8 +1140,7 @@ void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,
   if (!variableContent)
     return;
 
-  std::vector<std::string> list;
-  cmExpandList(variableContent, list);
+  std::vector<std::string> list = cmExpandedList(variableContent);
 
   for (std::string const& i : list) {
     stream << " " << QuotePath(i);

+ 1 - 2
Source/CPack/cmCPackBundleGenerator.cxx

@@ -204,8 +204,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
       ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES")
       : "";
 
-    std::vector<std::string> relFiles;
-    cmExpandList(sign_files, relFiles);
+    std::vector<std::string> relFiles = cmExpandedList(sign_files);
 
     // sign the files supplied by the user, ie. frameworks.
     for (auto const& file : relFiles) {

+ 1 - 2
Source/CPack/cmCPackDebGenerator.cxx

@@ -376,8 +376,7 @@ bool DebGenerator::generateControlTar(std::string const& md5Filename) const
     // default
     control_tar.ClearPermissions();
 
-    std::vector<std::string> controlExtraList;
-    cmExpandList(ControlExtra, controlExtraList);
+    std::vector<std::string> controlExtraList = cmExpandedList(ControlExtra);
     for (std::string const& i : controlExtraList) {
       std::string filenamename = cmsys::SystemTools::GetFilenameName(i);
       std::string localcopy = WorkDir + "/" + filenamename;

+ 2 - 2
Source/CPack/cmCPackDragNDropGenerator.cxx

@@ -128,8 +128,8 @@ int cmCPackDragNDropGenerator::InitializeInternal()
       return 0;
     }
 
-    std::vector<std::string> languages;
-    cmExpandList(this->GetOption("CPACK_DMG_SLA_LANGUAGES"), languages);
+    std::vector<std::string> languages =
+      cmExpandedList(this->GetOption("CPACK_DMG_SLA_LANGUAGES"));
     if (languages.empty()) {
       cmCPackLogger(cmCPackLog::LOG_ERROR,
                     "CPACK_DMG_SLA_LANGUAGES set but empty" << std::endl);

+ 6 - 6
Source/CPack/cmCPackFreeBSDGenerator.cxx

@@ -228,8 +228,8 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
   manifest << ManifestKeyValue(
     "desc", var_lookup("CPACK_FREEBSD_PACKAGE_DESCRIPTION"));
   manifest << ManifestKeyValue("www", var_lookup("CPACK_FREEBSD_PACKAGE_WWW"));
-  std::vector<std::string> licenses;
-  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"), licenses);
+  std::vector<std::string> licenses =
+    cmExpandedList(var_lookup("CPACK_FREEBSD_PACKAGE_LICENSE"));
   std::string licenselogic("single");
   if (licenses.empty()) {
     cmSystemTools::SetFatalErrorOccured();
@@ -238,12 +238,12 @@ void cmCPackFreeBSDGenerator::write_manifest_fields(
   }
   manifest << ManifestKeyValue("licenselogic", licenselogic);
   manifest << (ManifestKeyListValue("licenses") << licenses);
-  std::vector<std::string> categories;
-  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"), categories);
+  std::vector<std::string> categories =
+    cmExpandedList(var_lookup("CPACK_FREEBSD_PACKAGE_CATEGORIES"));
   manifest << (ManifestKeyListValue("categories") << categories);
   manifest << ManifestKeyValue("prefix", var_lookup("CMAKE_INSTALL_PREFIX"));
-  std::vector<std::string> deps;
-  cmExpandList(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"), deps);
+  std::vector<std::string> deps =
+    cmExpandedList(var_lookup("CPACK_FREEBSD_PACKAGE_DEPS"));
   if (!deps.empty()) {
     manifest << (ManifestKeyDepsValue("deps") << deps);
   }

+ 16 - 18
Source/CPack/cmCPackGenerator.cxx

@@ -210,8 +210,8 @@ int cmCPackGenerator::InstallProject()
   const char* default_dir_install_permissions =
     this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
   if (default_dir_install_permissions && *default_dir_install_permissions) {
-    std::vector<std::string> items;
-    cmExpandList(default_dir_install_permissions, items);
+    std::vector<std::string> items =
+      cmExpandedList(default_dir_install_permissions);
     for (const auto& arg : items) {
       if (!cmFSPermissions::stringToModeT(arg, default_dir_mode_v)) {
         cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -273,8 +273,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
     std::string tempInstallDirectoryEnv =
       cmStrCat("CMAKE_INSTALL_PREFIX=", tempInstallDirectory);
     cmSystemTools::PutEnv(tempInstallDirectoryEnv);
-    std::vector<std::string> installCommandsVector;
-    cmExpandList(installCommands, installCommandsVector);
+    std::vector<std::string> installCommandsVector =
+      cmExpandedList(installCommands);
     for (std::string const& ic : installCommandsVector) {
       cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
       std::string output;
@@ -310,8 +310,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
   std::vector<cmsys::RegularExpression> ignoreFilesRegex;
   const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
   if (cpackIgnoreFiles) {
-    std::vector<std::string> ignoreFilesRegexString;
-    cmExpandList(cpackIgnoreFiles, ignoreFilesRegexString);
+    std::vector<std::string> ignoreFilesRegexString =
+      cmExpandedList(cpackIgnoreFiles);
     for (std::string const& ifr : ignoreFilesRegexString) {
       cmCPackLogger(cmCPackLog::LOG_VERBOSE,
                     "Create ignore files regex for: " << ifr << std::endl);
@@ -321,8 +321,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
   const char* installDirectories =
     this->GetOption("CPACK_INSTALLED_DIRECTORIES");
   if (installDirectories && *installDirectories) {
-    std::vector<std::string> installDirectoriesVector;
-    cmExpandList(installDirectories, installDirectoriesVector);
+    std::vector<std::string> installDirectoriesVector =
+      cmExpandedList(installDirectories);
     if (installDirectoriesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
@@ -460,8 +460,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
   if (cmakeScripts && *cmakeScripts) {
     cmCPackLogger(cmCPackLog::LOG_OUTPUT,
                   "- Install scripts: " << cmakeScripts << std::endl);
-    std::vector<std::string> cmakeScriptsVector;
-    cmExpandList(cmakeScripts, cmakeScriptsVector);
+    std::vector<std::string> cmakeScriptsVector = cmExpandedList(cmakeScripts);
     for (std::string const& installScript : cmakeScriptsVector) {
 
       cmCPackLogger(cmCPackLog::LOG_OUTPUT,
@@ -525,8 +524,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
                       << std::endl);
       return 0;
     }
-    std::vector<std::string> cmakeProjectsVector;
-    cmExpandList(cmakeProjects, cmakeProjectsVector);
+    std::vector<std::string> cmakeProjectsVector =
+      cmExpandedList(cmakeProjects);
     std::vector<std::string>::iterator it;
     for (it = cmakeProjectsVector.begin(); it != cmakeProjectsVector.end();
          ++it) {
@@ -570,8 +569,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
           cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES";
         const char* installTypes = this->GetOption(installTypesVar);
         if (installTypes && *installTypes) {
-          std::vector<std::string> installTypesVector;
-          cmExpandList(installTypes, installTypesVector);
+          std::vector<std::string> installTypesVector =
+            cmExpandedList(installTypes);
           for (std::string const& installType : installTypesVector) {
             project.InstallationTypes.push_back(
               this->GetInstallationType(project.ProjectName, installType));
@@ -1493,8 +1492,8 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
     // Determine the installation types.
     const char* installTypes = this->GetOption(macroPrefix + "_INSTALL_TYPES");
     if (installTypes && *installTypes) {
-      std::vector<std::string> installTypesVector;
-      cmExpandList(installTypes, installTypesVector);
+      std::vector<std::string> installTypesVector =
+        cmExpandedList(installTypes);
       for (std::string const& installType : installTypesVector) {
         component->InstallationTypes.push_back(
           this->GetInstallationType(projectName, installType));
@@ -1504,8 +1503,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
     // Determine the component dependencies.
     const char* depends = this->GetOption(macroPrefix + "_DEPENDS");
     if (depends && *depends) {
-      std::vector<std::string> dependsVector;
-      cmExpandList(depends, dependsVector);
+      std::vector<std::string> dependsVector = cmExpandedList(depends);
       for (std::string const& depend : dependsVector) {
         cmCPackComponent* child = GetComponent(projectName, depend);
         component->Dependencies.push_back(child);

+ 4 - 4
Source/CPack/cmCPackNSISGenerator.cxx

@@ -471,8 +471,8 @@ int cmCPackNSISGenerator::InitializeInternal()
     cmCPackLogger(cmCPackLog::LOG_DEBUG,
                   "The cpackPackageExecutables: " << cpackPackageExecutables
                                                   << "." << std::endl);
-    std::vector<std::string> cpackPackageExecutablesVector;
-    cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
+    std::vector<std::string> cpackPackageExecutablesVector =
+      cmExpandedList(cpackPackageExecutables);
     if (cpackPackageExecutablesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,
@@ -524,8 +524,8 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
   }
   cmCPackLogger(cmCPackLog::LOG_DEBUG,
                 "The cpackMenuLinks: " << cpackMenuLinks << "." << std::endl);
-  std::vector<std::string> cpackMenuLinksVector;
-  cmExpandList(cpackMenuLinks, cpackMenuLinksVector);
+  std::vector<std::string> cpackMenuLinksVector =
+    cmExpandedList(cpackMenuLinks);
   if (cpackMenuLinksVector.size() % 2 != 0) {
     cmCPackLogger(
       cmCPackLog::LOG_ERROR,

+ 2 - 2
Source/CPack/cmCPackOSXX11Generator.cxx

@@ -29,8 +29,8 @@ int cmCPackOSXX11Generator::PackageFiles()
                                                   << "." << std::endl);
     std::ostringstream str;
     std::ostringstream deleteStr;
-    std::vector<std::string> cpackPackageExecutablesVector;
-    cmExpandList(cpackPackageExecutables, cpackPackageExecutablesVector);
+    std::vector<std::string> cpackPackageExecutablesVector =
+      cmExpandedList(cpackPackageExecutables);
     if (cpackPackageExecutablesVector.size() % 2 != 0) {
       cmCPackLogger(
         cmCPackLog::LOG_ERROR,

+ 1 - 2
Source/CPack/cpack.cxx

@@ -333,8 +333,7 @@ int main(int argc, char const* const* argv)
       cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
                   "CPack generator not specified" << std::endl);
     } else {
-      std::vector<std::string> generatorsVector;
-      cmExpandList(genList, generatorsVector);
+      std::vector<std::string> generatorsVector = cmExpandedList(genList);
       for (std::string const& gen : generatorsVector) {
         cmMakefile::ScopePushPop raii(&globalMF);
         cmMakefile* mf = &globalMF;

+ 1 - 2
Source/CTest/cmCTestGIT.cxx

@@ -211,8 +211,7 @@ bool cmCTestGIT::UpdateByFetchAndReset()
 
 bool cmCTestGIT::UpdateByCustom(std::string const& custom)
 {
-  std::vector<std::string> git_custom_command;
-  cmExpandList(custom, git_custom_command, true);
+  std::vector<std::string> git_custom_command = cmExpandedList(custom, true);
   std::vector<char const*> git_custom;
   git_custom.reserve(git_custom_command.size() + 1);
   for (std::string const& i : git_custom_command) {

+ 1 - 2
Source/CTest/cmCTestP4.cxx

@@ -460,8 +460,7 @@ bool cmCTestP4::LoadModifications()
 
 bool cmCTestP4::UpdateCustom(const std::string& custom)
 {
-  std::vector<std::string> p4_custom_command;
-  cmExpandList(custom, p4_custom_command, true);
+  std::vector<std::string> p4_custom_command = cmExpandedList(custom, true);
 
   std::vector<char const*> p4_custom;
   p4_custom.reserve(p4_custom_command.size() + 1);

+ 3 - 6
Source/CTest/cmCTestScriptHandler.cxx

@@ -544,8 +544,7 @@ int cmCTestScriptHandler::RunCurrentScript()
 
   // set any environment variables
   if (!this->CTestEnv.empty()) {
-    std::vector<std::string> envArgs;
-    cmExpandList(this->CTestEnv, envArgs);
+    std::vector<std::string> envArgs = cmExpandedList(this->CTestEnv);
     cmSystemTools::AppendEnv(envArgs);
   }
 
@@ -649,8 +648,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
   // do an initial cvs update as required
   command = this->UpdateCmd;
   for (std::string const& eu : this->ExtraUpdates) {
-    std::vector<std::string> cvsArgs;
-    cmExpandList(eu, cvsArgs);
+    std::vector<std::string> cvsArgs = cmExpandedList(eu);
     if (cvsArgs.size() == 2) {
       std::string fullCommand = cmStrCat(command, " update ", cvsArgs[1]);
       output.clear();
@@ -789,8 +787,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
   }
 
   // run ctest, it may be more than one command in here
-  std::vector<std::string> ctestCommands;
-  cmExpandList(this->CTestCmd, ctestCommands);
+  std::vector<std::string> ctestCommands = cmExpandedList(this->CTestCmd);
   // for each variable/argument do a putenv
   for (std::string const& ctestCommand : ctestCommands) {
     command = ctestCommand;

+ 2 - 4
Source/CTest/cmCTestSubmitCommand.cxx

@@ -68,16 +68,14 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
   const char* notesFilesVariable =
     this->Makefile->GetDefinition("CTEST_NOTES_FILES");
   if (notesFilesVariable) {
-    std::vector<std::string> notesFiles;
-    cmExpandList(notesFilesVariable, notesFiles);
+    std::vector<std::string> notesFiles = cmExpandedList(notesFilesVariable);
     this->CTest->GenerateNotesFile(notesFiles);
   }
 
   const char* extraFilesVariable =
     this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES");
   if (extraFilesVariable) {
-    std::vector<std::string> extraFiles;
-    cmExpandList(extraFilesVariable, extraFiles);
+    std::vector<std::string> extraFiles = cmExpandedList(extraFilesVariable);
     if (!this->CTest->SubmitExtraFiles(extraFiles)) {
       this->SetError("problem submitting extra files.");
       return nullptr;

+ 2 - 4
Source/CTest/cmCTestSubmitHandler.cxx

@@ -155,8 +155,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
   /* In windows, this will init the winsock stuff */
   ::curl_global_init(CURL_GLOBAL_ALL);
   std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
-  std::vector<std::string> args;
-  cmExpandList(curlopt, args);
+  std::vector<std::string> args = cmExpandedList(curlopt);
   bool verifyPeerOff = false;
   bool verifyHostOff = false;
   for (std::string const& arg : args) {
@@ -499,8 +498,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
   cmCTestCurl curl(this->CTest);
   curl.SetQuiet(this->Quiet);
   std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
-  std::vector<std::string> args;
-  cmExpandList(curlopt, args);
+  std::vector<std::string> args = cmExpandedList(curlopt);
   curl.SetCurlOptions(args);
   curl.SetTimeOutSeconds(SUBMIT_TIMEOUT_IN_SECONDS_DEFAULT);
   curl.SetHttpHeaders(this->HttpHeaders);

+ 11 - 22
Source/CTest/cmCTestTestHandler.cxx

@@ -2185,26 +2185,22 @@ bool cmCTestTestHandler::SetTestsProperties(
             cmExpandList(val, rt.AttachOnFail);
           }
           if (key == "RESOURCE_LOCK") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
 
             rt.LockedResources.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_SETUP") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
 
             rt.FixturesSetup.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_CLEANUP") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
 
             rt.FixturesCleanup.insert(lval.begin(), lval.end());
           }
           if (key == "FIXTURES_REQUIRED") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
 
             rt.FixturesRequired.insert(lval.begin(), lval.end());
           }
@@ -2222,15 +2218,13 @@ bool cmCTestTestHandler::SetTestsProperties(
             rt.RunSerial = cmIsOn(val);
           }
           if (key == "FAIL_REGULAR_EXPRESSION") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
             for (std::string const& cr : lval) {
               rt.ErrorRegularExpressions.emplace_back(cr, cr);
             }
           }
           if (key == "SKIP_REGULAR_EXPRESSION") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
             for (std::string const& cr : lval) {
               rt.SkipRegularExpressions.emplace_back(cr, cr);
             }
@@ -2257,8 +2251,7 @@ bool cmCTestTestHandler::SetTestsProperties(
             cmExpandList(val, rt.Environment);
           }
           if (key == "LABELS") {
-            std::vector<std::string> Labels;
-            cmExpandList(val, Labels);
+            std::vector<std::string> Labels = cmExpandedList(val);
             rt.Labels.insert(rt.Labels.end(), Labels.begin(), Labels.end());
             // sort the array
             std::sort(rt.Labels.begin(), rt.Labels.end());
@@ -2278,8 +2271,7 @@ bool cmCTestTestHandler::SetTestsProperties(
             }
           }
           if (key == "PASS_REGULAR_EXPRESSION") {
-            std::vector<std::string> lval;
-            cmExpandList(val, lval);
+            std::vector<std::string> lval = cmExpandedList(val);
             for (std::string const& cr : lval) {
               rt.RequiredRegularExpressions.emplace_back(cr, cr);
             }
@@ -2288,16 +2280,14 @@ bool cmCTestTestHandler::SetTestsProperties(
             rt.Directory = val;
           }
           if (key == "TIMEOUT_AFTER_MATCH") {
-            std::vector<std::string> propArgs;
-            cmExpandList(val, propArgs);
+            std::vector<std::string> propArgs = cmExpandedList(val);
             if (propArgs.size() != 2) {
               cmCTestLog(this->CTest, WARNING,
                          "TIMEOUT_AFTER_MATCH expects two arguments, found "
                            << propArgs.size() << std::endl);
             } else {
               rt.AlternateTimeout = cmDuration(atof(propArgs[0].c_str()));
-              std::vector<std::string> lval;
-              cmExpandList(propArgs[1], lval);
+              std::vector<std::string> lval = cmExpandedList(propArgs[1]);
               for (std::string const& cr : lval) {
                 rt.TimeoutRegularExpressions.emplace_back(cr, cr);
               }
@@ -2339,8 +2329,7 @@ bool cmCTestTestHandler::SetDirectoryProperties(
       std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
       if (cwd == rt.Directory) {
         if (key == "LABELS") {
-          std::vector<std::string> DirectoryLabels;
-          cmExpandList(val, DirectoryLabels);
+          std::vector<std::string> DirectoryLabels = cmExpandedList(val);
           rt.Labels.insert(rt.Labels.end(), DirectoryLabels.begin(),
                            DirectoryLabels.end());
 

+ 1 - 2
Source/CursesDialog/cmCursesCacheEntryComposite.cxx

@@ -71,8 +71,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
         cmCursesOptionsWidget* ow =
           new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
         this->Entry = ow;
-        std::vector<std::string> options;
-        cmExpandList(stringsProp, options);
+        std::vector<std::string> options = cmExpandedList(stringsProp);
         for (auto const& opt : options) {
           ow->AddOption(opt);
         }

+ 2 - 4
Source/cmCTest.cxx

@@ -1448,8 +1448,7 @@ void cmCTest::AddSiteProperties(cmXMLWriter& xml)
     if (labels) {
       xml.StartElement("Labels");
       std::string l = labels;
-      std::vector<std::string> args;
-      cmExpandList(l, args);
+      std::vector<std::string> args = cmExpandedList(l);
       for (std::string const& i : args) {
         xml.Element("Label", i);
       }
@@ -1481,8 +1480,7 @@ std::vector<std::string> cmCTest::GetLabelsForSubprojects()
 {
   std::string labelsForSubprojects =
     this->GetCTestConfiguration("LabelsForSubprojects");
-  std::vector<std::string> subprojects;
-  cmExpandList(labelsForSubprojects, subprojects);
+  std::vector<std::string> subprojects = cmExpandedList(labelsForSubprojects);
 
   // sort the array
   std::sort(subprojects.begin(), subprojects.end());

+ 1 - 2
Source/cmCacheManager.cxx

@@ -541,8 +541,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value,
   // make sure we only use unix style paths
   if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) {
     if (e.Value.find(';') != std::string::npos) {
-      std::vector<std::string> paths;
-      cmExpandList(e.Value, paths);
+      std::vector<std::string> paths = cmExpandedList(e.Value);
       const char* sep = "";
       e.Value = "";
       for (std::string& i : paths) {

+ 1 - 2
Source/cmComputeLinkDepends.cxx

@@ -436,8 +436,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index,
   // This is called to add the dependencies named by
   // <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;
-  cmExpandList(value, deplist);
+  std::vector<std::string> deplist = cmExpandedList(value);
 
   // Look for entries meant for this configuration.
   std::vector<cmLinkItem> actual_libs;

+ 5 - 10
Source/cmComputeLinkInformation.cxx

@@ -541,8 +541,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
   // linker language.
   std::string libVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_LIBRARIES");
   if (const char* libs = this->Makefile->GetDefinition(libVar)) {
-    std::vector<std::string> libsVec;
-    cmExpandList(libs, libsVec);
+    std::vector<std::string> libsVec = cmExpandedList(libs);
     for (std::string const& i : libsVec) {
       if (!cmContains(this->ImplicitLinkLibs, i)) {
         this->AddItem(i, nullptr);
@@ -554,8 +553,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang)
   // implied by the linker language.
   std::string dirVar = cmStrCat("CMAKE_", lang, "_IMPLICIT_LINK_DIRECTORIES");
   if (const char* dirs = this->Makefile->GetDefinition(dirVar)) {
-    std::vector<std::string> dirsVec;
-    cmExpandList(dirs, dirsVec);
+    std::vector<std::string> dirsVec = cmExpandedList(dirs);
     this->OrderLinkerSearchPath->AddLanguageDirectories(dirsVec);
   }
 }
@@ -795,16 +793,14 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
                          LinkUnknown);
   if (const char* linkSuffixes =
         mf->GetDefinition("CMAKE_EXTRA_LINK_EXTENSIONS")) {
-    std::vector<std::string> linkSuffixVec;
-    cmExpandList(linkSuffixes, linkSuffixVec);
+    std::vector<std::string> linkSuffixVec = cmExpandedList(linkSuffixes);
     for (std::string const& i : linkSuffixVec) {
       this->AddLinkExtension(i.c_str(), LinkUnknown);
     }
   }
   if (const char* sharedSuffixes =
         mf->GetDefinition("CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES")) {
-    std::vector<std::string> sharedSuffixVec;
-    cmExpandList(sharedSuffixes, sharedSuffixVec);
+    std::vector<std::string> sharedSuffixVec = cmExpandedList(sharedSuffixes);
     for (std::string const& i : sharedSuffixVec) {
       this->AddLinkExtension(i.c_str(), LinkShared);
     }
@@ -1640,8 +1636,7 @@ static void cmCLI_ExpandListUnique(const char* str,
                                    std::vector<std::string>& out,
                                    std::set<std::string>& emitted)
 {
-  std::vector<std::string> tmp;
-  cmExpandList(str, tmp);
+  std::vector<std::string> tmp = cmExpandedList(str);
   for (std::string const& i : tmp) {
     if (emitted.insert(i).second) {
       out.push_back(i);

+ 1 - 2
Source/cmConditionEvaluator.cxx

@@ -668,8 +668,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
           def2 = this->Makefile.GetDefinition(argP2->GetValue());
 
           if (def2) {
-            std::vector<std::string> list;
-            cmExpandList(def2, list, true);
+            std::vector<std::string> list = cmExpandedList(def2, true);
 
             result = cmContains(list, def);
           }

+ 1 - 2
Source/cmCoreTryCompile.cxx

@@ -674,8 +674,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;
-        cmExpandList(varListStr, varList);
+        std::vector<std::string> varList = cmExpandedList(varListStr);
         vars.insert(varList.begin(), varList.end());
       }
 

+ 3 - 4
Source/cmExportBuildAndroidMKGenerator.cxx

@@ -143,8 +143,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
         }
       } else if (property.first == "INTERFACE_INCLUDE_DIRECTORIES") {
         std::string includes = property.second;
-        std::vector<std::string> includeList;
-        cmExpandList(includes, includeList);
+        std::vector<std::string> includeList = cmExpandedList(includes);
         os << "LOCAL_EXPORT_C_INCLUDES := ";
         std::string end;
         for (std::string const& i : includeList) {
@@ -154,8 +153,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties(
         os << "\n";
       } else if (property.first == "INTERFACE_LINK_OPTIONS") {
         os << "LOCAL_EXPORT_LDFLAGS := ";
-        std::vector<std::string> linkFlagsList;
-        cmExpandList(property.second, linkFlagsList);
+        std::vector<std::string> linkFlagsList =
+          cmExpandedList(property.second);
         os << cmJoin(linkFlagsList, " ") << "\n";
       } else {
         os << "# " << property.first << " " << (property.second) << "\n";

+ 1 - 2
Source/cmExportFileGenerator.cxx

@@ -499,8 +499,7 @@ void getPropertyContents(cmGeneratorTarget const* tgt, const std::string& prop,
   if (!p) {
     return;
   }
-  std::vector<std::string> content;
-  cmExpandList(p, content);
+  std::vector<std::string> content = cmExpandedList(p);
   ifaceProperties.insert(content.begin(), content.end());
 }
 

+ 1 - 2
Source/cmExportTryCompileFileGenerator.cxx

@@ -103,8 +103,7 @@ void cmExportTryCompileFileGenerator::PopulateProperties(
       std::string evalResult =
         this->FindTargets(p, target, std::string(), emitted);
 
-      std::vector<std::string> depends;
-      cmExpandList(evalResult, depends);
+      std::vector<std::string> depends = cmExpandedList(evalResult);
       for (std::string const& li : depends) {
         cmGeneratorTarget* tgt =
           target->GetLocalGenerator()->FindGeneratorTargetToUse(li);

+ 5 - 10
Source/cmExtraEclipseCDT4Generator.cxx

@@ -415,8 +415,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
 
   if (const char* extraNaturesProp =
         mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_NATURES")) {
-    std::vector<std::string> extraNatures;
-    cmExpandList(extraNaturesProp, extraNatures);
+    std::vector<std::string> extraNatures = cmExpandedList(extraNaturesProp);
     for (std::string const& n : extraNatures) {
       xml.Element("nature", n);
     }
@@ -797,8 +796,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     mf->GetDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS");
   if (this->CEnabled && cDefs) {
     // Expand the list.
-    std::vector<std::string> defs;
-    cmExpandList(cDefs, defs, true);
+    std::vector<std::string> defs = cmExpandedList(cDefs, true);
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
@@ -830,8 +828,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     mf->GetDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS");
   if (this->CXXEnabled && cxxDefs) {
     // Expand the list.
-    std::vector<std::string> defs;
-    cmExpandList(cxxDefs, defs, true);
+    std::vector<std::string> defs = cmExpandedList(cxxDefs, true);
 
     // the list must contain only definition-value pairs:
     if ((defs.size() % 2) == 0) {
@@ -881,16 +878,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   if (this->CEnabled && !compiler.empty()) {
     std::string systemIncludeDirs =
       mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
-    std::vector<std::string> dirs;
-    cmExpandList(systemIncludeDirs, dirs);
+    std::vector<std::string> dirs = cmExpandedList(systemIncludeDirs);
     this->AppendIncludeDirectories(xml, dirs, emmited);
   }
   compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
   if (this->CXXEnabled && !compiler.empty()) {
     std::string systemIncludeDirs =
       mf->GetSafeDefinition("CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS");
-    std::vector<std::string> dirs;
-    cmExpandList(systemIncludeDirs, dirs);
+    std::vector<std::string> dirs = cmExpandedList(systemIncludeDirs);
     this->AppendIncludeDirectories(xml, dirs, emmited);
   }
 

+ 1 - 2
Source/cmExtraSublimeTextGenerator.cxx

@@ -134,8 +134,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
   // End of build_systems
   fout << "\n\t]";
   std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
-  std::vector<std::string> tokens;
-  cmExpandList(this->EnvSettings, tokens);
+  std::vector<std::string> tokens = cmExpandedList(this->EnvSettings);
 
   if (!this->EnvSettings.empty()) {
     fout << ",";

+ 2 - 2
Source/cmFileCopier.cxx

@@ -173,8 +173,8 @@ bool cmFileCopier::GetDefaultDirectoryPermissions(mode_t** mode)
   const char* default_dir_install_permissions = this->Makefile->GetDefinition(
     "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS");
   if (default_dir_install_permissions && *default_dir_install_permissions) {
-    std::vector<std::string> items;
-    cmExpandList(default_dir_install_permissions, items);
+    std::vector<std::string> items =
+      cmExpandedList(default_dir_install_permissions);
     for (const auto& arg : items) {
       if (!this->CheckPermissions(arg, **mode)) {
         this->Status.SetError(

+ 3 - 6
Source/cmGeneratorExpressionNode.cxx

@@ -375,8 +375,7 @@ static const struct RemoveDuplicatesNode : public cmGeneratorExpressionNode
         "$<REMOVE_DUPLICATES:...> expression requires one parameter");
     }
 
-    std::vector<std::string> values;
-    cmExpandList(parameters.front(), values, true);
+    std::vector<std::string> values = cmExpandedList(parameters.front(), true);
 
     auto valuesEnd = cmRemoveDuplicates(values);
     auto valuesBegin = values.cbegin();
@@ -939,8 +938,7 @@ static const struct JoinNode : public cmGeneratorExpressionNode
     const GeneratorExpressionContent* /*content*/,
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
-    std::vector<std::string> list;
-    cmExpandList(parameters.front(), list);
+    std::vector<std::string> list = cmExpandedList(parameters.front());
     return cmJoin(list, parameters[1]);
   }
 } joinNode;
@@ -2209,8 +2207,7 @@ static const struct ShellPathNode : public cmGeneratorExpressionNode
     const GeneratorExpressionContent* content,
     cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
   {
-    std::vector<std::string> listIn;
-    cmExpandList(parameters.front(), listIn);
+    std::vector<std::string> listIn = cmExpandedList(parameters.front());
     if (listIn.empty()) {
       reportError(context, content->GetOriginalExpression(),
                   "\"\" is not an absolute path.");

+ 11 - 22
Source/cmGeneratorTarget.cxx

@@ -1405,8 +1405,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
 
     cmStringRange sourceEntries = this->Target->GetSourceEntries();
     for (std::string const& entry : sourceEntries) {
-      std::vector<std::string> items;
-      cmExpandList(entry, items);
+      std::vector<std::string> items = cmExpandedList(entry);
       for (std::string const& item : items) {
         if (cmHasLiteralPrefix(item, "$<TARGET_OBJECTS:") &&
             item.back() == '>') {
@@ -2674,8 +2673,7 @@ void cmTargetTraceDependencies::Trace()
 
     // Queue dependencies added explicitly by the user.
     if (const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS")) {
-      std::vector<std::string> objDeps;
-      cmExpandList(additionalDeps, objDeps);
+      std::vector<std::string> objDeps = cmExpandedList(additionalDeps);
       for (std::string& objDep : objDeps) {
         if (cmSystemTools::FileIsFullPath(objDep)) {
           objDep = cmSystemTools::CollapseFullPath(objDep);
@@ -3363,8 +3361,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
   // actual linker wrapper
   const std::string wrapper(this->Makefile->GetSafeDefinition(
     "CMAKE_" + language + "_LINKER_WRAPPER_FLAG"));
-  std::vector<std::string> wrapperFlag;
-  cmExpandList(wrapper, wrapperFlag);
+  std::vector<std::string> wrapperFlag = cmExpandedList(wrapper);
   const std::string wrapperSep(this->Makefile->GetSafeDefinition(
     "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP"));
   bool concatFlagAndArgs = true;
@@ -3485,8 +3482,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;
-    cmExpandList(linkOptions, options);
+    std::vector<std::string> options = cmExpandedList(linkOptions);
     for (const auto& option : options) {
       std::unique_ptr<TargetPropertyEntry> entry(
         CreateTargetPropertyEntry(option));
@@ -3640,8 +3636,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;
-    cmExpandList(linkDepends, depends);
+    std::vector<std::string> depends = cmExpandedList(linkDepends);
     for (const auto& depend : depends) {
       std::unique_ptr<TargetPropertyEntry> entry(
         CreateTargetPropertyEntry(depend));
@@ -4184,8 +4179,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;
-    cmExpandList(files, relFiles);
+    std::vector<std::string> relFiles = cmExpandedList(files);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4198,8 +4192,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
   // Process private headers after public headers so that they take
   // precedence if a file is listed in both.
   if (const char* files = this->GetProperty("PRIVATE_HEADER")) {
-    std::vector<std::string> relFiles;
-    cmExpandList(files, relFiles);
+    std::vector<std::string> relFiles = cmExpandedList(files);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4211,8 +4204,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
 
   // Mark sources listed as resources.
   if (const char* files = this->GetProperty("RESOURCE")) {
-    std::vector<std::string> relFiles;
-    cmExpandList(files, relFiles);
+    std::vector<std::string> relFiles = cmExpandedList(files);
     for (std::string const& relFile : relFiles) {
       if (cmSourceFile* sf = this->Makefile->GetSource(relFile)) {
         SourceFileFlags& flags = this->SourceFlagsMap[sf];
@@ -4354,8 +4346,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
     return;
   }
 
-  std::vector<std::string> props;
-  cmExpandList(prop, props);
+  std::vector<std::string> props = cmExpandedList(prop);
   std::string pdir =
     cmStrCat(cmSystemTools::GetCMakeRoot(), "/Help/prop_tgt/");
 
@@ -5709,8 +5700,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
     this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
                           headTarget, usage_requirements_only, iface.Libraries,
                           iface.HadHeadSensitiveCondition);
-    std::vector<std::string> deps;
-    cmExpandList(info->SharedDeps, deps);
+    std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
     this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
   }
 
@@ -5993,8 +5983,7 @@ void cmGeneratorTarget::GetObjectLibrariesCMP0026(
   // behavior of CMP0024 and CMP0026 only.
   cmStringRange rng = this->Target->GetSourceEntries();
   for (std::string const& entry : rng) {
-    std::vector<std::string> files;
-    cmExpandList(entry, files);
+    std::vector<std::string> files = cmExpandedList(entry);
     for (std::string const& li : files) {
       if (cmHasLiteralPrefix(li, "$<TARGET_OBJECTS:") && li.back() == '>') {
         std::string objLibName = li.substr(17, li.size() - 18);

+ 1 - 2
Source/cmGhsMultiTargetGenerator.cxx

@@ -465,8 +465,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
 {
   const char* prop = sf->GetProperty(propName);
   if (prop) {
-    std::vector<std::string> list;
-    cmExpandList(prop, list);
+    std::vector<std::string> list = cmExpandedList(prop);
     for (auto& p : list) {
       fout << "    " << propFlag << p << std::endl;
     }

+ 4 - 6
Source/cmGlobalGenerator.cxx

@@ -1110,8 +1110,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l,
   std::string ignoreExtensionsVar =
     std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS");
   std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar);
-  std::vector<std::string> extensionList;
-  cmExpandList(ignoreExts, extensionList);
+  std::vector<std::string> extensionList = cmExpandedList(ignoreExts);
   for (std::string const& i : extensionList) {
     this->IgnoreExtensions[i] = true;
   }
@@ -1123,8 +1122,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l,
   std::string extensionsVar = std::string("CMAKE_") + std::string(l) +
     std::string("_SOURCE_FILE_EXTENSIONS");
   const std::string& exts = mf->GetSafeDefinition(extensionsVar);
-  std::vector<std::string> extensionList;
-  cmExpandList(exts, extensionList);
+  std::vector<std::string> extensionList = cmExpandedList(exts);
   for (std::string const& i : extensionList) {
     this->ExtensionToLanguage[i] = l;
   }
@@ -1581,8 +1579,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
         "CMAKE_" + li + "_STANDARD_INCLUDE_DIRECTORIES";
       std::string const& standardIncludesStr =
         mf->GetSafeDefinition(standardIncludesVar);
-      std::vector<std::string> standardIncludesVec;
-      cmExpandList(standardIncludesStr, standardIncludesVec);
+      std::vector<std::string> standardIncludesVec =
+        cmExpandedList(standardIncludesStr);
       standardIncludesSet.insert(standardIncludesVec.begin(),
                                  standardIncludesVec.end());
     }

+ 2 - 2
Source/cmGlobalGhsMultiGenerator.cxx

@@ -610,8 +610,8 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
   char const* ghsGpjMacros =
     this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
   if (nullptr != ghsGpjMacros) {
-    std::vector<std::string> expandedList;
-    cmExpandList(std::string(ghsGpjMacros), expandedList);
+    std::vector<std::string> expandedList =
+      cmExpandedList(std::string(ghsGpjMacros));
     for (std::string const& arg : expandedList) {
       fout << "macro " << arg << std::endl;
     }

+ 2 - 2
Source/cmGlobalVisualStudio7Generator.cxx

@@ -511,8 +511,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
           extensibilityAddInsOverridden = true;
         }
         fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
-        std::vector<std::string> keyValuePairs;
-        cmExpandList(root->GetMakefile()->GetProperty(it), keyValuePairs);
+        std::vector<std::string> keyValuePairs =
+          cmExpandedList(root->GetMakefile()->GetProperty(it));
         for (std::string const& itPair : keyValuePairs) {
           const std::string::size_type posEqual = itPair.find('=');
           if (posEqual != std::string::npos) {

+ 2 - 4
Source/cmGlobalXCodeGenerator.cxx

@@ -875,8 +875,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
   const char* extraFileAttributes = sf->GetProperty("XCODE_FILE_ATTRIBUTES");
   if (extraFileAttributes) {
     // Expand the list of attributes.
-    std::vector<std::string> attributes;
-    cmExpandList(extraFileAttributes, attributes);
+    std::vector<std::string> attributes = cmExpandedList(extraFileAttributes);
 
     // Store the attributes.
     for (const auto& attribute : attributes) {
@@ -3568,8 +3567,7 @@ void cmGlobalXCodeGenerator::AppendDefines(BuildObjectListOrString& defs,
   }
 
   // Expand the list of definitions.
-  std::vector<std::string> defines;
-  cmExpandList(defines_list, defines);
+  std::vector<std::string> defines = cmExpandedList(defines_list);
 
   // Store the definitions in the string.
   this->AppendDefines(defs, defines, dflag);

+ 2 - 2
Source/cmGraphVizWriter.cxx

@@ -235,8 +235,8 @@ void cmGraphVizWriter::ReadSettings(
 
   this->TargetsToIgnoreRegex.clear();
   if (!ignoreTargetsRegexes.empty()) {
-    std::vector<std::string> ignoreTargetsRegExVector;
-    cmExpandList(ignoreTargetsRegexes, ignoreTargetsRegExVector);
+    std::vector<std::string> ignoreTargetsRegExVector =
+      cmExpandedList(ignoreTargetsRegexes);
     for (std::string const& currentRegexString : ignoreTargetsRegExVector) {
       cmsys::RegularExpression currentRegex;
       if (!currentRegex.compile(currentRegexString)) {

+ 3 - 6
Source/cmInstallCommand.cxx

@@ -670,8 +670,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     if (createInstallGeneratorsForTargetFileSets && !namelinkOnly) {
       const char* files = target.GetProperty("PRIVATE_HEADER");
       if ((files) && (*files)) {
-        std::vector<std::string> relFiles;
-        cmExpandList(files, relFiles);
+        std::vector<std::string> relFiles = cmExpandedList(files);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("PRIVATE_HEADER", relFiles, absFiles)) {
           return false;
@@ -685,8 +684,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
 
       files = target.GetProperty("PUBLIC_HEADER");
       if ((files) && (*files)) {
-        std::vector<std::string> relFiles;
-        cmExpandList(files, relFiles);
+        std::vector<std::string> relFiles = cmExpandedList(files);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("PUBLIC_HEADER", relFiles, absFiles)) {
           return false;
@@ -700,8 +698,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
 
       files = target.GetProperty("RESOURCE");
       if ((files) && (*files)) {
-        std::vector<std::string> relFiles;
-        cmExpandList(files, relFiles);
+        std::vector<std::string> relFiles = cmExpandedList(files);
         std::vector<std::string> absFiles;
         if (!this->MakeFilesFullPath("RESOURCE", relFiles, absFiles)) {
           return false;

+ 1 - 2
Source/cmLDConfigLDConfigTool.cxx

@@ -33,8 +33,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths)
     }
   }
 
-  std::vector<std::string> ldConfigCommand;
-  cmExpandList(ldConfigPath, ldConfigCommand);
+  std::vector<std::string> ldConfigCommand = cmExpandedList(ldConfigPath);
   ldConfigCommand.emplace_back("-v");
   ldConfigCommand.emplace_back("-N"); // Don't rebuild the cache.
   ldConfigCommand.emplace_back("-X"); // Don't update links.

+ 1 - 2
Source/cmListFileCache.cxx

@@ -483,8 +483,7 @@ std::vector<BT<std::string>> ExpandListWithBacktrace(
   std::string const& list, cmListFileBacktrace const& bt)
 {
   std::vector<BT<std::string>> result;
-  std::vector<std::string> tmp;
-  cmExpandList(list, tmp);
+  std::vector<std::string> tmp = cmExpandedList(list);
   result.reserve(tmp.size());
   for (std::string& i : tmp) {
     result.emplace_back(std::move(i), bt);

+ 12 - 24
Source/cmLocalGenerator.cxx

@@ -311,8 +311,7 @@ void cmLocalGenerator::GenerateTestFiles()
   const char* testIncludeFiles =
     this->Makefile->GetProperty("TEST_INCLUDE_FILES");
   if (testIncludeFiles) {
-    std::vector<std::string> includesList;
-    cmExpandList(testIncludeFiles, includesList);
+    std::vector<std::string> includesList = cmExpandedList(testIncludeFiles);
     for (std::string const& i : includesList) {
       fout << "include(\"" << i << "\")" << std::endl;
     }
@@ -902,8 +901,7 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags,
           ge.Parse(jmcExprGen);
         std::string isJMCEnabled = cge->Evaluate(this, config);
         if (cmIsOn(isJMCEnabled)) {
-          std::vector<std::string> optVec;
-          cmExpandList(jmc, optVec);
+          std::vector<std::string> optVec = cmExpandedList(jmc);
           this->AppendCompileOptions(flags, optVec);
         }
       }
@@ -1769,8 +1767,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
         "CMAKE_" + lang + "_EXTENSION_COMPILE_OPTION";
       if (const char* opt =
             target->Target->GetMakefile()->GetDefinition(option_flag)) {
-        std::vector<std::string> optVec;
-        cmExpandList(opt, optVec);
+        std::vector<std::string> optVec = cmExpandedList(opt);
         for (std::string const& i : optVec) {
           this->AppendFlagEscape(flags, i);
         }
@@ -1798,8 +1795,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
            "does not know the compile flags to use to enable it.";
       this->IssueMessage(MessageType::FATAL_ERROR, e.str());
     } else {
-      std::vector<std::string> optVec;
-      cmExpandList(opt, optVec);
+      std::vector<std::string> optVec = cmExpandedList(opt);
       for (std::string const& i : optVec) {
         this->AppendFlagEscape(flags, i);
       }
@@ -1859,8 +1855,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
 
     std::string const& opt =
       target->Target->GetMakefile()->GetRequiredDefinition(option_flag);
-    std::vector<std::string> optVec;
-    cmExpandList(opt, optVec);
+    std::vector<std::string> optVec = cmExpandedList(opt);
     for (std::string const& i : optVec) {
       this->AppendFlagEscape(flags, i);
     }
@@ -1876,8 +1871,7 @@ void cmLocalGenerator::AddCompilerRequirementFlag(
 
     if (const char* opt =
           target->Target->GetMakefile()->GetDefinition(option_flag)) {
-      std::vector<std::string> optVec;
-      cmExpandList(opt, optVec);
+      std::vector<std::string> optVec = cmExpandedList(opt);
       for (std::string const& i : optVec) {
         this->AppendFlagEscape(flags, i);
       }
@@ -2072,8 +2066,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
       cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIC"));
   }
   if (!picFlags.empty()) {
-    std::vector<std::string> options;
-    cmExpandList(picFlags, options);
+    std::vector<std::string> options = cmExpandedList(picFlags);
     for (std::string const& o : options) {
       this->AppendFlagEscape(flags, o);
     }
@@ -2144,8 +2137,7 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
     return;
   }
 
-  std::vector<std::string> flagsList;
-  cmExpandList(rawFlagsList, flagsList);
+  std::vector<std::string> flagsList = cmExpandedList(rawFlagsList);
   for (std::string const& o : flagsList) {
     this->AppendFlagEscape(flags, o);
   }
@@ -2180,8 +2172,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
     return;
   }
 
-  std::vector<std::string> flagsList;
-  cmExpandList(pieFlags, flagsList);
+  std::vector<std::string> flagsList = cmExpandedList(pieFlags);
   for (const auto& flag : flagsList) {
     this->AppendFlagEscape(flags, flag);
   }
@@ -2197,8 +2188,7 @@ void cmLocalGenerator::AppendCompileOptions(std::string& options,
   }
 
   // Expand the list of options.
-  std::vector<std::string> options_vec;
-  cmExpandList(options_list, options_vec);
+  std::vector<std::string> options_vec = cmExpandedList(options_list);
   this->AppendCompileOptions(options, options_vec, regex);
 }
 
@@ -2232,8 +2222,7 @@ void cmLocalGenerator::AppendIncludeDirectories(
   }
 
   // Expand the list of includes.
-  std::vector<std::string> includes_vec;
-  cmExpandList(includes_list, includes_vec);
+  std::vector<std::string> includes_vec = cmExpandedList(includes_list);
   this->AppendIncludeDirectories(includes, includes_vec, sourceFile);
 }
 
@@ -2360,8 +2349,7 @@ void cmLocalGenerator::AppendFeatureOptions(std::string& flags,
   const char* optionList = this->Makefile->GetDefinition(
     cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_", feature));
   if (optionList != nullptr) {
-    std::vector<std::string> options;
-    cmExpandList(optionList, options);
+    std::vector<std::string> options = cmExpandedList(optionList);
     for (std::string const& o : options) {
       this->AppendFlagEscape(flags, o);
     }

+ 1 - 2
Source/cmLocalNinjaGenerator.cxx

@@ -221,8 +221,7 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os)
   if (jobpools) {
     cmGlobalNinjaGenerator::WriteComment(
       os, "Pools defined by global property JOB_POOLS");
-    std::vector<std::string> pools;
-    cmExpandList(jobpools, pools);
+    std::vector<std::string> pools = cmExpandedList(jobpools);
     for (std::string const& pool : pools) {
       const std::string::size_type eq = pool.find('=');
       unsigned int jobs;

+ 4 - 6
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -1455,8 +1455,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
   this->WriteDisclaimer(internalRuleFileStream);
 
   // for each language we need to scan, scan it
-  std::vector<std::string> langs;
-  cmExpandList(mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"), langs);
+  std::vector<std::string> langs =
+    cmExpandedList(mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"));
   for (std::string const& lang : langs) {
     // construct the checker
     // Create the scanner for this language
@@ -1500,8 +1500,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
   }
 
   // Convert the string to a list and preserve empty entries.
-  std::vector<std::string> pairs;
-  cmExpandList(pairs_string, pairs, true);
+  std::vector<std::string> pairs = cmExpandedList(pairs_string, true);
   for (std::vector<std::string>::const_iterator i = pairs.begin();
        i != pairs.end() && (i + 1) != pairs.end();) {
     const std::string& depender = *i++;
@@ -1727,8 +1726,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
   if (!infoDef) {
     return;
   }
-  std::vector<std::string> files;
-  cmExpandList(infoDef, files);
+  std::vector<std::string> files = cmExpandedList(infoDef);
 
   // Each depend information file corresponds to a target.  Clear the
   // dependencies for that target.

+ 1 - 2
Source/cmLocalVisualStudio7Generator.cxx

@@ -1492,8 +1492,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
 
     // Check for extra object-file dependencies.
     if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
-      std::vector<std::string> depends;
-      cmExpandList(deps, depends);
+      std::vector<std::string> depends = cmExpandedList(deps);
       const char* sep = "";
       for (std::vector<std::string>::iterator j = depends.begin();
            j != depends.end(); ++j) {

+ 14 - 28
Source/cmMakefile.cxx

@@ -1352,8 +1352,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
   if (remove) {
     if (const char* cdefs = this->GetProperty("COMPILE_DEFINITIONS")) {
       // Expand the list.
-      std::vector<std::string> defs;
-      cmExpandList(cdefs, defs);
+      std::vector<std::string> defs = cmExpandedList(cdefs);
 
       // Recompose the list without the definition.
       std::vector<std::string>::const_iterator defEnd =
@@ -1953,8 +1952,7 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
   }
 
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
-    std::vector<std::string> linkLibs;
-    cmExpandList(linkLibsProp, linkLibs);
+    std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
 
     for (std::vector<std::string>::iterator j = linkLibs.begin();
          j != linkLibs.end(); ++j) {
@@ -2281,8 +2279,7 @@ void cmMakefile::ExpandVariablesCMP0019()
   }
 
   if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
-    std::vector<std::string> linkLibs;
-    cmExpandList(linkLibsProp, linkLibs);
+    std::vector<std::string> linkLibs = cmExpandedList(linkLibsProp);
 
     for (std::vector<std::string>::iterator l = linkLibs.begin();
          l != linkLibs.end(); ++l) {
@@ -3200,8 +3197,7 @@ bool cmMakefile::ExpandArguments(
     if (i.Delim == cmListFileArgument::Quoted) {
       outArgs.emplace_back(value, true);
     } else {
-      std::vector<std::string> stringArgs;
-      cmExpandList(value, stringArgs);
+      std::vector<std::string> stringArgs = cmExpandedList(value);
       for (std::string const& stringArg : stringArgs) {
         outArgs.emplace_back(stringArg, false);
       }
@@ -3558,8 +3554,7 @@ std::string cmMakefile::GetModulesFile(const std::string& filename,
   // Always search in CMAKE_MODULE_PATH:
   const char* cmakeModulePath = this->GetDefinition("CMAKE_MODULE_PATH");
   if (cmakeModulePath) {
-    std::vector<std::string> modulePath;
-    cmExpandList(cmakeModulePath, modulePath);
+    std::vector<std::string> modulePath = cmExpandedList(cmakeModulePath);
 
     // Look through the possible module directories.
     for (std::string itempl : modulePath) {
@@ -4374,8 +4369,7 @@ bool cmMakefile::AddRequiredTargetFeature(cmTarget* target,
     return false;
   }
 
-  std::vector<std::string> availableFeatures;
-  cmExpandList(features, availableFeatures);
+  std::vector<std::string> availableFeatures = cmExpandedList(features);
   if (!cmContains(availableFeatures, feature)) {
     std::ostringstream e;
     e << "The compiler feature \"" << feature << "\" is not known to " << lang
@@ -4643,32 +4637,27 @@ void cmMakefile::CheckNeededCxxLanguage(const std::string& feature,
 {
   if (const char* propCxx98 =
         this->GetDefinition("CMAKE_CXX98_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propCxx98, props);
+    std::vector<std::string> props = cmExpandedList(propCxx98);
     needCxx98 = cmContains(props, feature);
   }
   if (const char* propCxx11 =
         this->GetDefinition("CMAKE_CXX11_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propCxx11, props);
+    std::vector<std::string> props = cmExpandedList(propCxx11);
     needCxx11 = cmContains(props, feature);
   }
   if (const char* propCxx14 =
         this->GetDefinition("CMAKE_CXX14_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propCxx14, props);
+    std::vector<std::string> props = cmExpandedList(propCxx14);
     needCxx14 = cmContains(props, feature);
   }
   if (const char* propCxx17 =
         this->GetDefinition("CMAKE_CXX17_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propCxx17, props);
+    std::vector<std::string> props = cmExpandedList(propCxx17);
     needCxx17 = cmContains(props, feature);
   }
   if (const char* propCxx20 =
         this->GetDefinition("CMAKE_CXX20_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propCxx20, props);
+    std::vector<std::string> props = cmExpandedList(propCxx20);
     needCxx20 = cmContains(props, feature);
   }
 }
@@ -4767,20 +4756,17 @@ void cmMakefile::CheckNeededCLanguage(const std::string& feature,
 {
   if (const char* propC90 =
         this->GetDefinition("CMAKE_C90_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propC90, props);
+    std::vector<std::string> props = cmExpandedList(propC90);
     needC90 = cmContains(props, feature);
   }
   if (const char* propC99 =
         this->GetDefinition("CMAKE_C99_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propC99, props);
+    std::vector<std::string> props = cmExpandedList(propC99);
     needC99 = cmContains(props, feature);
   }
   if (const char* propC11 =
         this->GetDefinition("CMAKE_C11_COMPILE_FEATURES")) {
-    std::vector<std::string> props;
-    cmExpandList(propC11, props);
+    std::vector<std::string> props = cmExpandedList(propC11);
     needC11 = cmContains(props, feature);
   }
 }

+ 5 - 6
Source/cmMakefileTargetGenerator.cxx

@@ -767,8 +767,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
     // If compiler launcher was specified and not consumed above, it
     // goes to the beginning of the command line.
     if (!compileCommands.empty() && !compilerLauncher.empty()) {
-      std::vector<std::string> args;
-      cmExpandList(compilerLauncher, args, true);
+      std::vector<std::string> args = cmExpandedList(compilerLauncher, true);
       if (!args.empty()) {
         args[0] = this->LocalGenerator->ConvertToOutputFormat(
           args[0], cmOutputConverter::SHELL);
@@ -840,8 +839,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
         cmStrCat("CMAKE_", lang, "_CREATE_PREPROCESSED_SOURCE");
       if (const char* preprocessRule =
             this->Makefile->GetDefinition(preprocessRuleVar)) {
-        std::vector<std::string> preprocessCommands;
-        cmExpandList(preprocessRule, preprocessCommands);
+        std::vector<std::string> preprocessCommands =
+          cmExpandedList(preprocessRule);
 
         std::string shellObjI = this->LocalGenerator->ConvertToOutputFormat(
           objI, cmOutputConverter::SHELL);
@@ -885,8 +884,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
         cmStrCat("CMAKE_", lang, "_CREATE_ASSEMBLY_SOURCE");
       if (const char* assemblyRule =
             this->Makefile->GetDefinition(assemblyRuleVar)) {
-        std::vector<std::string> assemblyCommands;
-        cmExpandList(assemblyRule, assemblyCommands);
+        std::vector<std::string> assemblyCommands =
+          cmExpandedList(assemblyRule);
 
         std::string shellObjS = this->LocalGenerator->ConvertToOutputFormat(
           objS, cmOutputConverter::SHELL);

+ 1 - 2
Source/cmNinjaTargetGenerator.cxx

@@ -725,8 +725,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
   // If compiler launcher was specified and not consumed above, it
   // goes to the beginning of the command line.
   if (!compileCmds.empty() && !compilerLauncher.empty()) {
-    std::vector<std::string> args;
-    cmExpandList(compilerLauncher, args, true);
+    std::vector<std::string> args = cmExpandedList(compilerLauncher, true);
     if (!args.empty()) {
       args[0] = this->LocalGenerator->ConvertToOutputFormat(
         args[0], cmOutputConverter::SHELL);

+ 1 - 2
Source/cmOutputRequiredFilesCommand.cxx

@@ -122,8 +122,7 @@ public:
       std::string incDirs = cmGeneratorExpression::Preprocess(
         incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions);
 
-      std::vector<std::string> includes;
-      cmExpandList(incDirs, includes);
+      std::vector<std::string> includes = cmExpandedList(incDirs);
 
       for (std::string& path : includes) {
         this->Makefile->ExpandVariablesInString(path);

+ 1 - 2
Source/cmParseArgumentsCommand.cxx

@@ -159,8 +159,7 @@ bool cmParseArgumentsCommand(std::vector<std::string> const& args,
   };
 
   // the second argument is a (cmake) list of options without argument
-  std::vector<std::string> list;
-  cmExpandList(*argIter++, list);
+  std::vector<std::string> list = cmExpandedList(*argIter++);
   parser.Bind(list, options, duplicateKey);
 
   // the third argument is a (cmake) list of single argument options

+ 4 - 7
Source/cmQtAutoGenInitializer.cxx

@@ -381,8 +381,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
       std::string const deps =
         this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS");
       if (!deps.empty()) {
-        std::vector<std::string> extraDeps;
-        cmExpandList(deps, extraDeps);
+        std::vector<std::string> extraDeps = cmExpandedList(deps);
         for (std::string const& depName : extraDeps) {
           // Allow target and file dependencies
           auto* depTarget = makefile->FindTargetToUse(depName);
@@ -796,8 +795,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
           std::string const uicOpts = sf->GetSafeProperty(kw.AUTOUIC_OPTIONS);
           if (!uicOpts.empty()) {
             this->Uic.FileFiles.push_back(std::move(realPath));
-            std::vector<std::string> optsVec;
-            cmExpandList(uicOpts, optsVec);
+            std::vector<std::string> optsVec = cmExpandedList(uicOpts);
             this->Uic.FileOptions.push_back(std::move(optsVec));
           }
         } else {
@@ -850,9 +848,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
   if (!this->Rcc.Qrcs.empty()) {
     const bool modernQt = (this->QtVersion.Major >= 5);
     // Target rcc options
-    std::vector<std::string> optionsTarget;
-    cmExpandList(this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS),
-                 optionsTarget);
+    std::vector<std::string> optionsTarget =
+      cmExpandedList(this->Target->GetSafeProperty(kw.AUTORCC_OPTIONS));
 
     // Check if file name is unique
     for (Qrc& qrc : this->Rcc.Qrcs) {

+ 3 - 4
Source/cmQtAutoMocUic.cxx

@@ -1491,8 +1491,8 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
     return makefile->IsOn(key);
   };
   auto InfoGetList = [makefile](const char* key) -> std::vector<std::string> {
-    std::vector<std::string> list;
-    cmExpandList(makefile->GetSafeDefinition(key), list);
+    std::vector<std::string> list =
+      cmExpandedList(makefile->GetSafeDefinition(key));
     return list;
   };
   auto InfoGetLists =
@@ -1530,8 +1530,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile)
   };
   auto InfoGetConfigList =
     [&InfoGetConfig](const char* key) -> std::vector<std::string> {
-    std::vector<std::string> list;
-    cmExpandList(InfoGetConfig(key), list);
+    std::vector<std::string> list = cmExpandedList(InfoGetConfig(key));
     return list;
   };
   auto LogInfoError = [this](std::string const& msg) -> bool {

+ 3 - 4
Source/cmQtAutoRcc.cxx

@@ -28,8 +28,8 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   };
   auto InfoGetList =
     [makefile](std::string const& key) -> std::vector<std::string> {
-    std::vector<std::string> list;
-    cmExpandList(makefile->GetSafeDefinition(key), list);
+    std::vector<std::string> list =
+      cmExpandedList(makefile->GetSafeDefinition(key));
     return list;
   };
   auto InfoGetConfig = [makefile,
@@ -46,8 +46,7 @@ bool cmQtAutoRcc::Init(cmMakefile* makefile)
   };
   auto InfoGetConfigList =
     [&InfoGetConfig](std::string const& key) -> std::vector<std::string> {
-    std::vector<std::string> list;
-    cmExpandList(InfoGetConfig(key), list);
+    std::vector<std::string> list = cmExpandedList(InfoGetConfig(key));
     return list;
   };
   auto LogInfoError = [this](std::string const& msg) -> bool {

+ 2 - 4
Source/cmSearchPath.cxx

@@ -78,8 +78,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;
-    cmExpandList(value, expanded);
+    std::vector<std::string> expanded = cmExpandedList(value);
 
     for (std::string const& p : expanded) {
       this->AddPathInternal(
@@ -103,8 +102,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;
-    cmExpandList(value, expanded);
+    std::vector<std::string> expanded = cmExpandedList(value);
 
     this->AddPrefixPaths(
       expanded, this->FC->Makefile->GetCurrentSourceDirectory().c_str());

+ 3 - 6
Source/cmTarget.cxx

@@ -88,8 +88,7 @@ const char* cmTargetPropertyComputer::GetSources<cmTarget>(
   std::ostringstream ss;
   const char* sep = "";
   for (std::string const& entry : entries) {
-    std::vector<std::string> files;
-    cmExpandList(entry, files);
+    std::vector<std::string> files = cmExpandedList(entry);
     for (std::string const& file : files) {
       if (cmHasLiteralPrefix(file, "$<TARGET_OBJECTS:") &&
           file.back() == '>') {
@@ -499,8 +498,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
     if (globals) {
       const std::string genName = mf->GetGlobalGenerator()->GetName();
       if (cmHasLiteralPrefix(genName, "Visual Studio")) {
-        std::vector<std::string> props;
-        cmExpandList(globals, props);
+        std::vector<std::string> props = cmExpandedList(globals);
         const std::string vsGlobal = "VS_GLOBAL_";
         for (const std::string& i : props) {
           // split NAME=VALUE
@@ -742,8 +740,7 @@ public:
 
   bool operator()(std::string const& entry)
   {
-    std::vector<std::string> files;
-    cmExpandList(entry, files);
+    std::vector<std::string> files = cmExpandedList(entry);
     std::vector<cmSourceFileLocation> locations;
     locations.reserve(files.size());
     std::transform(files.begin(), files.end(), std::back_inserter(locations),

+ 1 - 2
Source/cmTestGenerator.cxx

@@ -102,8 +102,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
     // Prepend with the emulator when cross compiling if required.
     const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR");
     if (emulator != nullptr && *emulator) {
-      std::vector<std::string> emulatorWithArgs;
-      cmExpandList(emulator, emulatorWithArgs);
+      std::vector<std::string> emulatorWithArgs = cmExpandedList(emulator);
       std::string emulatorExe(emulatorWithArgs[0]);
       cmSystemTools::ConvertToUnixSlashes(emulatorExe);
       os << cmOutputConverter::EscapeForCMake(emulatorExe) << " ";

+ 1 - 2
Source/cmTryRunCommand.cxx

@@ -170,8 +170,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
   const std::string& emulator =
     this->Makefile->GetSafeDefinition("CMAKE_CROSSCOMPILING_EMULATOR");
   if (!emulator.empty()) {
-    std::vector<std::string> emulatorWithArgs;
-    cmExpandList(emulator, emulatorWithArgs);
+    std::vector<std::string> emulatorWithArgs = cmExpandedList(emulator);
     finalCommand +=
       cmSystemTools::ConvertToRunCommandPath(emulatorWithArgs[0]);
     finalCommand += " ";

+ 2 - 2
Source/cmVisualStudio10TargetGenerator.cxx

@@ -851,8 +851,8 @@ void cmVisualStudio10TargetGenerator::WriteImports(Elem& e0)
   const char* imports =
     this->GeneratorTarget->Target->GetProperty("VS_PROJECT_IMPORT");
   if (imports) {
-    std::vector<std::string> argsSplit;
-    cmExpandList(std::string(imports), argsSplit, false);
+    std::vector<std::string> argsSplit =
+      cmExpandedList(std::string(imports), false);
     for (auto& path : argsSplit) {
       if (!cmsys::SystemTools::FileIsFullPath(path)) {
         path = this->Makefile->GetCurrentSourceDirectory() + "/" + path;

+ 2 - 4
Source/cmXCodeScheme.cxx

@@ -214,8 +214,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
 
   if (const char* argList =
         this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ARGUMENTS")) {
-    std::vector<std::string> arguments;
-    cmExpandList(argList, arguments);
+    std::vector<std::string> arguments = cmExpandedList(argList);
     if (!arguments.empty()) {
       xout.StartElement("CommandLineArguments");
 
@@ -235,8 +234,7 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
 
   if (const char* envList =
         this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ENVIRONMENT")) {
-    std::vector<std::string> envs;
-    cmExpandList(envList, envs);
+    std::vector<std::string> envs = cmExpandedList(envList);
     if (!envs.empty()) {
       xout.StartElement("EnvironmentVariables");
 

+ 3 - 6
Source/cmake.cxx

@@ -531,8 +531,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;
-    cmExpandList(includes, includeDirs);
+    std::vector<std::string> includeDirs = cmExpandedList(includes);
 
     gg->CreateGenerationObjects();
     cmLocalGenerator* lg = gg->LocalGenerators[0];
@@ -548,8 +547,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
     tgt->SetProperty("LINKER_LANGUAGE", language.c_str());
 
     std::string libs = mf->GetSafeDefinition("PACKAGE_LIBRARIES");
-    std::vector<std::string> libList;
-    cmExpandList(libs, libList);
+    std::vector<std::string> libList = cmExpandedList(libs);
     for (std::string const& lib : libList) {
       tgt->AddLinkLibrary(*mf, lib, GENERAL_LibraryType);
     }
@@ -1264,8 +1262,7 @@ struct SaveCacheEntry
 
 int cmake::HandleDeleteCacheVariables(const std::string& var)
 {
-  std::vector<std::string> argsSplit;
-  cmExpandList(std::string(var), argsSplit, true);
+  std::vector<std::string> argsSplit = cmExpandedList(std::string(var), true);
   // erase the property to avoid infinite recursion
   this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
   if (this->State->GetIsInTryCompile()) {

+ 3 - 6
Source/cmcmd.cxx

@@ -172,8 +172,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;
-  cmExpandList(runCmd, iwyu_cmd, true);
+  std::vector<std::string> iwyu_cmd = cmExpandedList(runCmd, 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.
@@ -262,8 +261,7 @@ static int HandleCppLint(const std::string& runCmd,
                          const std::vector<std::string>&)
 {
   // Construct the cpplint command line.
-  std::vector<std::string> cpplint_cmd;
-  cmExpandList(runCmd, cpplint_cmd, true);
+  std::vector<std::string> cpplint_cmd = cmExpandedList(runCmd, true);
   cpplint_cmd.push_back(sourceFile);
 
   // Run the cpplint command line.  Capture its output.
@@ -291,8 +289,7 @@ static int HandleCppCheck(const std::string& runCmd,
                           const std::vector<std::string>& orig_cmd)
 {
   // Construct the cpplint command line.
-  std::vector<std::string> cppcheck_cmd;
-  cmExpandList(runCmd, cppcheck_cmd, true);
+  std::vector<std::string> cppcheck_cmd = cmExpandedList(runCmd, true);
   // extract all the -D, -U, and -I options from the compile line
   for (auto const& opt : orig_cmd) {
     if (opt.size() > 2) {