소스 검색

cmMakefile: Remove AddUtilityCommand overload without byproducts

Daniel Eiband 6 년 전
부모
커밋
5a06efda05

+ 3 - 1
Source/cmCPluginAPI.cxx

@@ -220,8 +220,10 @@ void CCONV cmAddUtilityCommand(void* arg, const char* utilityName,
   }
 
   // Pass the call to the makefile instance.
+  std::vector<std::string> no_byproducts;
   mf->AddUtilityCommand(utilityName, cmCommandOrigin::Project,
-                        (all ? false : true), nullptr, depends2, commandLines);
+                        (all ? false : true), nullptr, no_byproducts, depends2,
+                        commandLines);
 }
 void CCONV cmAddCustomCommand(void* arg, const char* source,
                               const char* command, int numArgs,

+ 5 - 5
Source/cmGlobalVisualStudio8Generator.cxx

@@ -96,17 +96,18 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
     return false;
   }
 
-  const char* no_working_directory = nullptr;
-  std::vector<std::string> no_depends;
   std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
   cmLocalVisualStudio7Generator* lg =
     static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
   cmMakefile* mf = lg->GetMakefile();
 
-  cmCustomCommandLines noCommandLines;
+  const char* no_working_directory = nullptr;
+  std::vector<std::string> no_byproducts;
+  std::vector<std::string> no_depends;
+  cmCustomCommandLines no_commands;
   cmTarget* tgt = mf->AddUtilityCommand(
     CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, false,
-    no_working_directory, no_depends, noCommandLines);
+    no_working_directory, no_byproducts, no_depends, no_commands);
 
   cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
   lg->AddGeneratorTarget(gt);
@@ -182,7 +183,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
     // file as the main dependency because it would get
     // overwritten by the CreateVCProjBuildRule.
     // (this could be avoided with per-target source files)
-    std::vector<std::string> no_byproducts;
     std::string no_main_dependency;
     cmImplicitDependsList no_implicit_depends;
     if (cmSourceFile* file = mf->AddCustomCommandToOutput(

+ 3 - 2
Source/cmGlobalVisualStudioGenerator.cxx

@@ -183,7 +183,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
 {
   // Add a special target that depends on ALL projects for easy build
   // of one configuration only.
-  const char* no_working_dir = 0;
+  const char* no_working_dir = nullptr;
+  std::vector<std::string> no_byproducts;
   std::vector<std::string> no_depends;
   cmCustomCommandLines no_commands;
   for (auto const& it : this->ProjectMap) {
@@ -194,7 +195,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
       // considered always out of date.
       cmTarget* allBuild = gen[0]->GetMakefile()->AddUtilityCommand(
         "ALL_BUILD", cmCommandOrigin::Generator, true, no_working_dir,
-        no_depends, no_commands, false, "Build all projects");
+        no_byproducts, no_depends, no_commands, false, "Build all projects");
 
       cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
       gen[0]->AddGeneratorTarget(gt);

+ 8 - 7
Source/cmGlobalXCodeGenerator.cxx

@@ -497,12 +497,15 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
 {
   cmMakefile* mf = root->GetMakefile();
 
-  // Add ALL_BUILD
   const char* no_working_directory = nullptr;
+  std::vector<std::string> no_byproducts;
   std::vector<std::string> no_depends;
+
+  // Add ALL_BUILD
   cmTarget* allbuild = mf->AddUtilityCommand(
     "ALL_BUILD", cmCommandOrigin::Generator, true, no_working_directory,
-    no_depends, cmMakeSingleCommandLine({ "echo", "Build all projects" }));
+    no_byproducts, no_depends,
+    cmMakeSingleCommandLine({ "echo", "Build all projects" }));
 
   cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
   root->AddGeneratorTarget(allBuildGt);
@@ -526,7 +529,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
     cmSystemTools::ReplaceString(file, "\\ ", " ");
     cmTarget* check = mf->AddUtilityCommand(
       CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmCommandOrigin::Generator, true,
-      no_working_directory, no_depends,
+      no_working_directory, no_byproducts, no_depends,
       cmMakeSingleCommandLine({ "make", "-f", file }));
 
     cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
@@ -541,9 +544,8 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
         continue;
       }
 
-      std::string targetName = target->GetName();
-
-      if (regenerate && (targetName != CMAKE_CHECK_BUILD_SYSTEM_TARGET)) {
+      if (regenerate &&
+          (target->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)) {
         target->Target->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
       }
 
@@ -554,7 +556,6 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
       if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
         commandLines.front().back() = // fill placeholder
           this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
-        std::vector<std::string> no_byproducts;
         gen->GetMakefile()->AddCustomCommandToTarget(
           target->GetName(), no_byproducts, no_depends, commandLines,
           cmCustomCommandType::POST_BUILD, "Depend check for xcode",

+ 2 - 16
Source/cmMakefile.cxx

@@ -1211,20 +1211,6 @@ cmUtilityOutput cmMakefile::GetUtilityOutput(cmTarget* target)
   return { std::move(force), std::move(forceCMP0049) };
 }
 
-cmTarget* cmMakefile::AddUtilityCommand(
-  const std::string& utilityName, cmCommandOrigin origin, bool excludeFromAll,
-  const char* workingDirectory, const std::vector<std::string>& depends,
-  const cmCustomCommandLines& commandLines, bool escapeOldStyle,
-  const char* comment, bool uses_terminal, bool command_expand_lists,
-  const std::string& job_pool)
-{
-  std::vector<std::string> no_byproducts;
-  return this->AddUtilityCommand(
-    utilityName, origin, excludeFromAll, workingDirectory, no_byproducts,
-    depends, commandLines, escapeOldStyle, comment, uses_terminal,
-    command_expand_lists, job_pool);
-}
-
 cmTarget* cmMakefile::AddUtilityCommand(
   const std::string& utilityName, cmCommandOrigin origin, bool excludeFromAll,
   const char* workingDirectory, const std::vector<std::string>& byproducts,
@@ -1237,8 +1223,8 @@ cmTarget* cmMakefile::AddUtilityCommand(
     this->AddNewUtilityTarget(utilityName, origin, excludeFromAll);
 
   // Validate custom commands.
-  if (!this->ValidateCustomCommand(commandLines) ||
-      (commandLines.empty() && depends.empty())) {
+  if ((commandLines.empty() && depends.empty()) ||
+      !this->ValidateCustomCommand(commandLines)) {
     return target;
   }
 

+ 0 - 7
Source/cmMakefile.h

@@ -261,13 +261,6 @@ public:
    * Add a utility to the build.  A utility target is a command that
    * is run every time the target is built.
    */
-  cmTarget* AddUtilityCommand(
-    const std::string& utilityName, cmCommandOrigin origin,
-    bool excludeFromAll, const char* workingDirectory,
-    const std::vector<std::string>& depends,
-    const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
-    const char* comment = nullptr, bool uses_terminal = false,
-    bool command_expand_lists = false, const std::string& job_pool = "");
   cmTarget* AddUtilityCommand(
     const std::string& utilityName, cmCommandOrigin origin,
     bool excludeFromAll, const char* workingDirectory,