From 7f3ecbe7d7210667770d3212e2bfdb0c701cdc5d Mon Sep 17 00:00:00 2001
From: Daniel Eiband <daniel.eiband@brainlab.com>
Date: Fri, 13 Sep 2019 19:44:37 +0200
Subject: cmCustomCommandLine: Provide command line make functions

Reduce boilerplate necessary to create custom command lines by introducing and
applying cmMakeCommandLine and cmMakeSingleCommandLine functions.
---
 Source/CMakeLists.txt                     |  2 ++
 Source/cmCustomCommandLines.cxx           | 22 +++++++++++++++++++
 Source/cmCustomCommandLines.h             | 19 ++++++++++-------
 Source/cmFLTKWrapUICommand.cxx            | 19 ++++++++---------
 Source/cmGlobalVisualStudio8Generator.cxx | 22 ++++++-------------
 Source/cmGlobalVisualStudioGenerator.cxx  | 11 +++-------
 Source/cmGlobalXCodeGenerator.cxx         | 35 ++++++++++++-------------------
 Source/cmLocalVisualStudio7Generator.cxx  | 25 +++++++---------------
 Source/cmLocalVisualStudioGenerator.cxx   |  9 ++------
 Source/cmQTWrapCPPCommand.cxx             | 12 ++---------
 Source/cmQTWrapUICommand.cxx              | 33 ++++++-----------------------
 Source/cmQtAutoGenInitializer.cxx         | 33 ++++++++---------------------
 12 files changed, 93 insertions(+), 149 deletions(-)
 create mode 100644 Source/cmCustomCommandLines.cxx

diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index decb39a..65cd6c9 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -191,6 +191,8 @@ set(SRCS
   cmCustomCommand.h
   cmCustomCommandGenerator.cxx
   cmCustomCommandGenerator.h
+  cmCustomCommandLines.cxx
+  cmCustomCommandLines.h
   cmDefinitions.cxx
   cmDefinitions.h
   cmDepends.cxx
diff --git a/Source/cmCustomCommandLines.cxx b/Source/cmCustomCommandLines.cxx
new file mode 100644
index 0000000..37ad75b
--- /dev/null
+++ b/Source/cmCustomCommandLines.cxx
@@ -0,0 +1,22 @@
+/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+   file Copyright.txt or https://cmake.org/licensing for details.  */
+#include "cmCustomCommandLines.h"
+
+cmCustomCommandLine cmMakeCommandLine(
+  std::initializer_list<cm::string_view> ilist)
+{
+  cmCustomCommandLine commandLine;
+  commandLine.reserve(ilist.size());
+  for (cm::string_view cmd : ilist) {
+    commandLine.emplace_back(cmd);
+  }
+  return commandLine;
+}
+
+cmCustomCommandLines cmMakeSingleCommandLine(
+  std::initializer_list<cm::string_view> ilist)
+{
+  cmCustomCommandLines commandLines;
+  commandLines.push_back(cmMakeCommandLine(ilist));
+  return commandLines;
+}
diff --git a/Source/cmCustomCommandLines.h b/Source/cmCustomCommandLines.h
index 35a15ba..213aeb1 100644
--- a/Source/cmCustomCommandLines.h
+++ b/Source/cmCustomCommandLines.h
@@ -5,25 +5,28 @@
 
 #include "cmConfigure.h" // IWYU pragma: keep
 
+#include <initializer_list>
 #include <string>
 #include <vector>
 
+#include "cm_string_view.hxx" // IWYU pragma: keep
+
 /** Data structure to represent a single command line.  */
 class cmCustomCommandLine : public std::vector<std::string>
 {
-public:
-  using Superclass = std::vector<std::string>;
-  using iterator = Superclass::iterator;
-  using const_iterator = Superclass::const_iterator;
 };
 
 /** Data structure to represent a list of command lines.  */
 class cmCustomCommandLines : public std::vector<cmCustomCommandLine>
 {
-public:
-  using Superclass = std::vector<cmCustomCommandLine>;
-  using iterator = Superclass::iterator;
-  using const_iterator = Superclass::const_iterator;
 };
 
+/** Return a command line from a list of command line parts.  */
+cmCustomCommandLine cmMakeCommandLine(
+  std::initializer_list<cm::string_view> ilist);
+
+/** Return a command line vector with a single command line.  */
+cmCustomCommandLines cmMakeSingleCommandLine(
+  std::initializer_list<cm::string_view> ilist);
+
 #endif
diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx
index 654714e..11844e4 100644
--- a/Source/cmFLTKWrapUICommand.cxx
+++ b/Source/cmFLTKWrapUICommand.cxx
@@ -77,16 +77,15 @@ bool cmFLTKWrapUICommand(std::vector<std::string> const& args,
       depends.push_back(fluid_exe);
       std::string cxxres = cmStrCat(outName, ".cxx");
 
-      cmCustomCommandLine commandLine;
-      commandLine.push_back(fluid_exe);
-      commandLine.push_back("-c"); // instructs Fluid to run in command line
-      commandLine.push_back("-h"); // optionally rename .h files
-      commandLine.push_back(hname);
-      commandLine.push_back("-o"); // optionally rename .cxx files
-      commandLine.push_back(cxxres);
-      commandLine.push_back(origname); // name of the GUI fluid file
-      cmCustomCommandLines commandLines;
-      commandLines.push_back(commandLine);
+      cmCustomCommandLines commandLines = cmMakeSingleCommandLine({
+        fluid_exe,
+        "-c", // instructs Fluid to run in command line
+        "-h", // optionally rename .h files
+        hname,
+        "-o", // optionally rename .cxx files
+        cxxres,
+        origname // name of the GUI fluid file
+      });
 
       // Add command for generating the .h and .cxx files
       std::string no_main_dependency;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 18ff9ac..255739d 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -3,6 +3,7 @@
 #include "cmGlobalVisualStudio8Generator.h"
 
 #include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
 #include "cmDocumentationEntry.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpression.h"
@@ -146,12 +147,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
     // Add a custom prebuild target to run the VerifyGlobs script.
     cmake* cm = this->GetCMakeInstance();
     if (cm->DoWriteGlobVerifyTarget()) {
-      cmCustomCommandLine verifyCommandLine;
-      verifyCommandLine.push_back(cmSystemTools::GetCMakeCommand());
-      verifyCommandLine.push_back("-P");
-      verifyCommandLine.push_back(cm->GetGlobVerifyScript());
-      cmCustomCommandLines verifyCommandLines;
-      verifyCommandLines.push_back(verifyCommandLine);
+      cmCustomCommandLines verifyCommandLines = cmMakeSingleCommandLine(
+        { cmSystemTools::GetCMakeCommand(), "-P", cm->GetGlobVerifyScript() });
       std::vector<std::string> byproducts;
       byproducts.push_back(cm->GetGlobVerifyStamp());
 
@@ -173,20 +170,13 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
     listFiles.erase(new_end, listFiles.end());
 
     // Create a rule to re-run CMake.
-    cmCustomCommandLine commandLine;
-    commandLine.push_back(cmSystemTools::GetCMakeCommand());
     std::string argS = cmStrCat("-S", lg->GetSourceDirectory());
-    commandLine.push_back(argS);
     std::string argB = cmStrCat("-B", lg->GetBinaryDirectory());
-    commandLine.push_back(argB);
-    commandLine.push_back("--check-stamp-list");
-    commandLine.push_back(stampList.c_str());
-    commandLine.push_back("--vs-solution-file");
     std::string const sln =
       lg->GetBinaryDirectory() + "/" + lg->GetProjectName() + ".sln";
-    commandLine.push_back(sln);
-    cmCustomCommandLines commandLines;
-    commandLines.push_back(commandLine);
+    cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
+      { cmSystemTools::GetCMakeCommand(), argS, argB, "--check-stamp-list",
+        stampList, "--vs-solution-file", sln });
 
     // Add the rule.  Note that we cannot use the CMakeLists.txt
     // file as the main dependency because it would get
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6e0b804..a0ce740 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -13,6 +13,7 @@
 #include "cmAlgorithms.h"
 #include "cmCallVisualStudioMacro.h"
 #include "cmCustomCommand.h"
+#include "cmCustomCommandLines.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmLocalVisualStudioGenerator.h"
@@ -900,17 +901,11 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
   std::string obj_dir = gt->ObjectDirectory;
   std::string cmakeCommand = cmSystemTools::GetCMakeCommand();
   cmSystemTools::ConvertToWindowsExtendedPath(cmakeCommand);
-  cmCustomCommandLine cmdl;
-  cmdl.push_back(cmakeCommand);
-  cmdl.push_back("-E");
-  cmdl.push_back("__create_def");
-  cmdl.push_back(mdi->DefFile);
   std::string obj_dir_expanded = obj_dir;
   cmSystemTools::ReplaceString(obj_dir_expanded, this->GetCMakeCFGIntDir(),
                                configName.c_str());
   cmSystemTools::MakeDirectory(obj_dir_expanded);
   std::string const objs_file = obj_dir_expanded + "/objects.txt";
-  cmdl.push_back(objs_file);
   cmGeneratedFileStream fout(objs_file.c_str());
   if (!fout) {
     cmSystemTools::Error("could not open " + objs_file);
@@ -948,8 +943,8 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
     fout << i->GetFullPath() << "\n";
   }
 
-  cmCustomCommandLines commandLines;
-  commandLines.push_back(cmdl);
+  cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
+    { cmakeCommand, "-E", "__create_def", mdi->DefFile, objs_file });
   cmCustomCommand command(gt->Target->GetMakefile(), outputs, empty, empty,
                           commandLines, "Auto build dll exports", ".");
   commands.push_back(command);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index de04e84..4d41fd7 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -15,6 +15,7 @@
 #include "cmComputeLinkInformation.h"
 #include "cmCustomCommand.h"
 #include "cmCustomCommandGenerator.h"
+#include "cmCustomCommandLines.h"
 #include "cmDocumentationEntry.h"
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorExpression.h"
@@ -500,22 +501,18 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
   const char* no_working_directory = nullptr;
   std::vector<std::string> no_depends;
   cmTarget* allbuild = mf->AddUtilityCommand(
-    "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true, no_depends,
-    no_working_directory, "echo", "Build all projects");
+    "ALL_BUILD", cmMakefile::TargetOrigin::Generator, true,
+    no_working_directory, no_depends,
+    cmMakeSingleCommandLine({ "echo", "Build all projects" }));
 
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
   root->AddGeneratorTarget(allBuildGt);
 
   // Add XCODE depend helper
   std::string dir = root->GetCurrentBinaryDirectory();
-  cmCustomCommandLine makeHelper;
-  makeHelper.push_back("make");
-  makeHelper.push_back("-C");
-  makeHelper.push_back(dir);
-  makeHelper.push_back("-f");
-  makeHelper.push_back(this->CurrentXCodeHackMakefile);
-  makeHelper.push_back("OBJDIR=$(OBJDIR)");
-  makeHelper.push_back(""); // placeholder, see below
+  cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
+    { "make", "-C", dir, "-f", this->CurrentXCodeHackMakefile,
+      "OBJDIR=$(OBJDIR)", /* placeholder, see below */ "" });
 
   // Add ZERO_CHECK
   bool regenerate = !this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION");
@@ -530,7 +527,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
     cmSystemTools::ReplaceString(file, "\\ ", " ");
     cmTarget* check = mf->AddUtilityCommand(
       CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator,
-      true, no_depends, no_working_directory, "make", "-f", file.c_str());
+      true, no_working_directory, no_depends,
+      cmMakeSingleCommandLine({ "make", "-f", file }));
 
     cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
     root->AddGeneratorTarget(checkGt);
@@ -555,10 +553,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
       // this will make sure that when the next target is built
       // things are up-to-date
       if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
-        makeHelper.back() = // fill placeholder
+        commandLines.front().back() = // fill placeholder
           this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
-        cmCustomCommandLines commandLines;
-        commandLines.push_back(makeHelper);
         std::vector<std::string> no_byproducts;
         gen->GetMakefile()->AddCustomCommandToTarget(
           target->GetName(), no_byproducts, no_depends, commandLines,
@@ -1440,19 +1436,14 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
 
   if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
       !gtgt->IsFrameworkOnApple()) {
-    cmCustomCommandLines cmd;
-    cmd.resize(1);
-    cmd[0].push_back(cmSystemTools::GetCMakeCommand());
-    cmd[0].push_back("-E");
-    cmd[0].push_back("cmake_symlink_library");
     std::string str_file = cmStrCat("$<TARGET_FILE:", gtgt->GetName(), '>');
     std::string str_so_file =
       cmStrCat("$<TARGET_SONAME_FILE:", gtgt->GetName(), '>');
     std::string str_link_file =
       cmStrCat("$<TARGET_LINKER_FILE:", gtgt->GetName(), '>');
-    cmd[0].push_back(str_file);
-    cmd[0].push_back(str_so_file);
-    cmd[0].push_back(str_link_file);
+    cmCustomCommandLines cmd = cmMakeSingleCommandLine(
+      { cmSystemTools::GetCMakeCommand(), "-E", "cmake_symlink_library",
+        str_file, str_so_file, str_link_file });
 
     cmCustomCommand command(this->CurrentMakefile, std::vector<std::string>(),
                             std::vector<std::string>(),
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 6c7fb2b..026f494 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -92,11 +92,8 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
   for (cmGeneratorTarget* l : tgts) {
     if (l->GetType() == cmStateEnums::GLOBAL_TARGET) {
       std::vector<std::string> no_depends;
-      cmCustomCommandLine force_command;
-      force_command.push_back("cd");
-      force_command.push_back(".");
-      cmCustomCommandLines force_commands;
-      force_commands.push_back(force_command);
+      cmCustomCommandLines force_commands =
+        cmMakeSingleCommandLine({ "cd", "." });
       std::string no_main_dependency;
       std::string force = cmStrCat(this->GetCurrentBinaryDirectory(),
                                    "/CMakeFiles/", l->GetName(), "_force");
@@ -246,21 +243,15 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
     std::unique(listFiles.begin(), listFiles.end());
   listFiles.erase(new_end, listFiles.end());
 
+  std::string argS = cmStrCat("-S", this->GetSourceDirectory());
+  std::string argB = cmStrCat("-B", this->GetBinaryDirectory());
   std::string stampName =
     cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/generate.stamp");
-  cmCustomCommandLine commandLine;
-  commandLine.push_back(cmSystemTools::GetCMakeCommand());
+  cmCustomCommandLines commandLines =
+    cmMakeSingleCommandLine({ cmSystemTools::GetCMakeCommand(), argS, argB,
+                              "--check-stamp-file", stampName });
   std::string comment = cmStrCat("Building Custom Rule ", makefileIn);
-  std::string args;
-  args = cmStrCat("-S", this->GetSourceDirectory());
-  commandLine.push_back(args);
-  args = cmStrCat("-B", this->GetBinaryDirectory());
-  commandLine.push_back(args);
-  commandLine.push_back("--check-stamp-file");
-  commandLine.push_back(stampName);
-  cmCustomCommandLines commandLines;
-  commandLines.push_back(commandLine);
-  const char* no_working_directory = 0;
+  const char* no_working_directory = nullptr;
   std::string fullpathStampName =
     cmSystemTools::CollapseFullPath(stampName.c_str());
   this->Makefile->AddCustomCommandToOutput(
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index f3f2042..cec9c02 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -98,16 +98,11 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
   }
 
   // Add a pre-build event to create the directory.
-  cmCustomCommandLine command;
-  command.push_back(cmSystemTools::GetCMakeCommand());
-  command.push_back("-E");
-  command.push_back("make_directory");
-  command.push_back(impDir);
   std::vector<std::string> no_output;
   std::vector<std::string> no_byproducts;
   std::vector<std::string> no_depends;
-  cmCustomCommandLines commands;
-  commands.push_back(command);
+  cmCustomCommandLines commands = cmMakeSingleCommandLine(
+    { cmSystemTools::GetCMakeCommand(), "-E", "make_directory", impDir });
   pcc.reset(new cmCustomCommand(0, no_output, no_byproducts, no_depends,
                                 commands, 0, 0));
   pcc->SetEscapeOldStyle(false);
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 1a5602b..cc4df8f 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -2,8 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmQTWrapCPPCommand.h"
 
-#include <utility>
-
 #include "cmCustomCommandLines.h"
 #include "cmExecutionStatus.h"
 #include "cmMakefile.h"
@@ -65,14 +63,8 @@ bool cmQTWrapCPPCommand(std::vector<std::string> const& args,
       sourceListValue += newName;
 
       // Create the custom command to generate the file.
-      cmCustomCommandLine commandLine;
-      commandLine.push_back(moc_exe);
-      commandLine.push_back("-o");
-      commandLine.push_back(newName);
-      commandLine.push_back(hname);
-
-      cmCustomCommandLines commandLines;
-      commandLines.push_back(std::move(commandLine));
+      cmCustomCommandLines commandLines =
+        cmMakeSingleCommandLine({ moc_exe, "-o", newName, hname });
 
       std::vector<std::string> depends;
       depends.push_back(moc_exe);
diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx
index b7b5efa..66c0228 100644
--- a/Source/cmQTWrapUICommand.cxx
+++ b/Source/cmQTWrapUICommand.cxx
@@ -2,8 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmQTWrapUICommand.h"
 
-#include <utility>
-
 #include "cmCustomCommandLines.h"
 #include "cmExecutionStatus.h"
 #include "cmMakefile.h"
@@ -76,31 +74,12 @@ bool cmQTWrapUICommand(std::vector<std::string> const& args,
       sourceListValue += mocName;
 
       // set up .ui to .h and .cxx command
-      cmCustomCommandLine hCommand;
-      hCommand.push_back(uic_exe);
-      hCommand.push_back("-o");
-      hCommand.push_back(hName);
-      hCommand.push_back(uiName);
-      cmCustomCommandLines hCommandLines;
-      hCommandLines.push_back(std::move(hCommand));
-
-      cmCustomCommandLine cxxCommand;
-      cxxCommand.push_back(uic_exe);
-      cxxCommand.push_back("-impl");
-      cxxCommand.push_back(hName);
-      cxxCommand.push_back("-o");
-      cxxCommand.push_back(cxxName);
-      cxxCommand.push_back(uiName);
-      cmCustomCommandLines cxxCommandLines;
-      cxxCommandLines.push_back(std::move(cxxCommand));
-
-      cmCustomCommandLine mocCommand;
-      mocCommand.push_back(moc_exe);
-      mocCommand.push_back("-o");
-      mocCommand.push_back(mocName);
-      mocCommand.push_back(hName);
-      cmCustomCommandLines mocCommandLines;
-      mocCommandLines.push_back(std::move(mocCommand));
+      cmCustomCommandLines hCommandLines =
+        cmMakeSingleCommandLine({ uic_exe, "-o", hName, uiName });
+      cmCustomCommandLines cxxCommandLines = cmMakeSingleCommandLine(
+        { uic_exe, "-impl", hName, "-o", cxxName, uiName });
+      cmCustomCommandLines mocCommandLines =
+        cmMakeSingleCommandLine({ moc_exe, "-o", mocName, hName });
 
       std::vector<std::string> depends;
       depends.push_back(uiName);
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 54304c3..355141e 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -957,16 +957,9 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
   }
 
   // Compose command lines
-  cmCustomCommandLines commandLines;
-  {
-    cmCustomCommandLine currentLine;
-    currentLine.push_back(cmSystemTools::GetCMakeCommand());
-    currentLine.push_back("-E");
-    currentLine.push_back("cmake_autogen");
-    currentLine.push_back(this->AutogenTarget.InfoFile);
-    currentLine.push_back("$<CONFIGURATION>");
-    commandLines.push_back(std::move(currentLine));
-  }
+  cmCustomCommandLines commandLines = cmMakeSingleCommandLine(
+    { cmSystemTools::GetCMakeCommand(), "-E", "cmake_autogen",
+      this->AutogenTarget.InfoFile, "$<CONFIGURATION>" });
 
   // Use PRE_BUILD on demand
   bool usePRE_BUILD = false;
@@ -1100,22 +1093,14 @@ bool cmQtAutoGenInitializer::InitRccTargets()
     if (this->MultiConfig) {
       // Build for all configurations
       for (std::string const& config : this->ConfigsList) {
-        cmCustomCommandLine currentLine;
-        currentLine.push_back(cmSystemTools::GetCMakeCommand());
-        currentLine.push_back("-E");
-        currentLine.push_back("cmake_autorcc");
-        currentLine.push_back(qrc.InfoFile);
-        currentLine.push_back(config);
-        commandLines.push_back(std::move(currentLine));
+        commandLines.push_back(
+          cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
+                              "cmake_autorcc", qrc.InfoFile, config }));
       }
     } else {
-      cmCustomCommandLine currentLine;
-      currentLine.push_back(cmSystemTools::GetCMakeCommand());
-      currentLine.push_back("-E");
-      currentLine.push_back("cmake_autorcc");
-      currentLine.push_back(qrc.InfoFile);
-      currentLine.push_back("$<CONFIG>");
-      commandLines.push_back(std::move(currentLine));
+      commandLines.push_back(
+        cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E",
+                            "cmake_autorcc", qrc.InfoFile, "$<CONFIG>" }));
     }
     std::string ccComment = cmStrCat(
       "Automatic RCC for ", FileProjectRelativePath(makefile, qrc.QrcFile));
-- 
cgit v0.12