瀏覽代碼

ENH: Cleaned up signature of cmMakefile::AddUtilityCommand. It is not valid to have an output from a utility rule and no calls to the method asked for an output anyway. The argument has been removed.

Brad King 19 年之前
父節點
當前提交
7d2de52c1a

+ 1 - 2
Source/cmAddCustomTargetCommand.cxx

@@ -149,8 +149,7 @@ bool cmAddCustomTargetCommand::InitialPass(
 
   // Add the utility target to the makefile.
   bool escapeOldStyle = !verbatim;
-  const char* no_output = 0;
-  this->Makefile->AddUtilityCommand(args[0].c_str(), all, no_output,
+  this->Makefile->AddUtilityCommand(args[0].c_str(), all,
                                     working_directory.c_str(), depends,
                                     commandLines, escapeOldStyle);
 

+ 3 - 13
Source/cmCPluginAPI.cxx

@@ -206,8 +206,8 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
                          int all,
                          int numDepends,
                          const char **depends,
-                         int numOutputs,
-                         const char **outputs)
+                         int,
+                         const char **)
 {
   // Get the makefile instance.  Perform an extra variable expansion
   // now because the API caller expects it.
@@ -234,19 +234,9 @@ void CCONV cmAddUtilityCommand(void *arg, const char* utilityName,
     depends2.push_back(mf->ExpandVariablesInString(expand));
     }
 
-  // Only one output is allowed.
-  const char* output = 0;
-  std::string outputStr;
-  if(numOutputs > 0)
-    {
-    expand = outputs[0];
-    outputStr = mf->ExpandVariablesInString(expand);
-    output = outputStr.c_str();
-    }
-
   // Pass the call to the makefile instance.
   mf->AddUtilityCommand(utilityName, (all ? true : false),
-                        output, 0, depends2, commandLines);
+                        0, depends2, commandLines);
 }
 void CCONV cmAddCustomCommand(void *arg, const char* source,
                         const char* command,

+ 1 - 2
Source/cmGlobalGenerator.cxx

@@ -1300,7 +1300,6 @@ void cmGlobalGenerator::SetupTests()
     // If the file doesn't exist, then ENABLE_TESTING hasn't been run
     if (total_tests > 0)
       {
-      const char* no_output = 0;
       const char* no_working_dir = 0;
       std::vector<std::string> no_depends;
       std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -1313,7 +1312,7 @@ void cmGlobalGenerator::SetupTests()
           cmMakefile* mf = gen[0]->GetMakefile();
           if(const char* outDir = mf->GetDefinition("CMAKE_CFG_INTDIR"))
             {
-            mf->AddUtilityCommand("RUN_TESTS", false, no_output, no_depends,
+            mf->AddUtilityCommand("RUN_TESTS", false, no_depends,
                                   no_working_dir, 
                                   ctest.c_str(), "-C", outDir);
             }

+ 1 - 2
Source/cmGlobalVisualStudio6Generator.cxx

@@ -162,7 +162,6 @@ void cmGlobalVisualStudio6Generator::Generate()
 {
   // add a special target that depends on ALL projects for easy build
   // of one configuration only.
-  const char* no_output = 0;
   std::vector<std::string> no_depends;
   const char* no_working_dir = 0;
   std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -173,7 +172,7 @@ void cmGlobalVisualStudio6Generator::Generate()
     if(gen.size())
       {
       gen[0]->GetMakefile()->AddUtilityCommand("ALL_BUILD", false, 
-                                               no_output, no_depends, 
+                                               no_depends, 
                                                no_working_dir,
                                                "echo", "Build all projects");
       }

+ 1 - 2
Source/cmGlobalVisualStudio7Generator.cxx

@@ -216,7 +216,6 @@ void cmGlobalVisualStudio7Generator::Generate()
 {
   // add a special target that depends on ALL projects for easy build
   // of one configuration only.
-  const char* no_output = 0;
   const char* no_working_dir = 0;
   std::vector<std::string> no_depends;
   std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -227,7 +226,7 @@ void cmGlobalVisualStudio7Generator::Generate()
     if(gen.size())
       {
       gen[0]->GetMakefile()->
-        AddUtilityCommand("ALL_BUILD", false, no_output, no_depends,
+        AddUtilityCommand("ALL_BUILD", false, no_depends,
                           no_working_dir,
                           "echo", "Build all projects");
       std::string cmake_command = 

+ 3 - 4
Source/cmGlobalVisualStudio8Generator.cxx

@@ -75,7 +75,6 @@ void cmGlobalVisualStudio8Generator::Generate()
 {
   // Add a special target on which all other targets depend that
   // checks the build system and optionally re-runs CMake.
-  const char* no_output = 0;
   const char* no_working_directory = 0;
   std::vector<std::string> no_depends;
   std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
@@ -90,10 +89,10 @@ void cmGlobalVisualStudio8Generator::Generate()
         static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
       cmMakefile* mf = lg->GetMakefile();
       std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
+      cmCustomCommandLines noCommandLines;
       mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true,
-                            no_output, no_depends,
-                            no_working_directory,
-                            "echo", "Checking build system");
+                            no_working_directory, no_depends,
+                            noCommandLines);
       cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
       if(!tgt)
         {

+ 2 - 3
Source/cmGlobalXCodeGenerator.cxx

@@ -281,10 +281,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
 {
   cmMakefile* mf = root->GetMakefile();
   // Add ALL_BUILD
-  const char* no_output = 0;
   const char* no_working_directory = 0;
   std::vector<std::string> no_depends;
-  mf->AddUtilityCommand("ALL_BUILD", false, no_output, no_depends,
+  mf->AddUtilityCommand("ALL_BUILD", false, no_depends,
                         no_working_directory,
                         "echo", "Build all projects");
   cmTarget* allbuild = mf->FindTarget("ALL_BUILD");
@@ -307,7 +306,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
     }
   cmCustomCommandLines commandLines;
   commandLines.push_back(makecommand);
-  mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false, no_output,
+  mf->AddUtilityCommand("XCODE_DEPEND_HELPER", false,
                         no_working_directory,
                         no_depends,
                         commandLines);

+ 1 - 2
Source/cmIncludeExternalMSProjectCommand.cxx

@@ -46,10 +46,9 @@ bool cmIncludeExternalMSProjectCommand
     utility_name += args[0];
     std::string path = args[1];
     cmSystemTools::ConvertToUnixSlashes(path);
-    const char* no_output = 0;
     const char* no_working_directory = 0;
     this->Makefile->AddUtilityCommand(utility_name.c_str(), true,
-                                  no_output, depends,
+                                  depends,
                                   no_working_directory,
                                   args[0].c_str(), path.c_str());
     

+ 1 - 7
Source/cmMakefile.cxx

@@ -783,7 +783,6 @@ cmMakefile::AddCustomCommandOldStyle(const char* target,
 
 //----------------------------------------------------------------------------
 void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
-                                   const char* output,
                                    const std::vector<std::string>& depends,
                                    const char* workingDirectory,
                                    const char* command,
@@ -815,13 +814,12 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
   commandLines.push_back(commandLine);
 
   // Call the real signature of this method.
-  this->AddUtilityCommand(utilityName, all, output, workingDirectory, 
+  this->AddUtilityCommand(utilityName, all, workingDirectory, 
                           depends, commandLines);
 }
 
 //----------------------------------------------------------------------------
 void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
-                                   const char* output,
                                    const char* workingDirectory,
                                    const std::vector<std::string>& depends,
                                    const cmCustomCommandLines& commandLines,
@@ -834,10 +832,6 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
   target.SetMakefile(this);
   // Store the custom command in the target.
   std::vector<std::string> outputs;
-  if(output)
-    {
-    outputs.push_back(output);
-    }
   cmCustomCommand cc(outputs, depends, commandLines, 0, workingDirectory);
   cc.SetEscapeOldStyle(escapeOldStyle);
   target.GetPostBuildCommands().push_back(cc);

+ 0 - 2
Source/cmMakefile.h

@@ -183,7 +183,6 @@ public:
    * is run every time the target is built.
    */
   void AddUtilityCommand(const char* utilityName, bool all,
-                         const char* output,
                          const std::vector<std::string>& depends,
                          const char* workingDirectory,
                          const char* command,
@@ -192,7 +191,6 @@ public:
                          const char* arg3=0,
                          const char* arg4=0);
   void AddUtilityCommand(const char* utilityName, bool all,
-                         const char* output,
                          const char* workingDirectory,
                          const std::vector<std::string>& depends,
                          const cmCustomCommandLines& commandLines,

+ 3 - 4
Source/cmVTKWrapJavaCommand.cxx

@@ -190,9 +190,8 @@ void cmVTKWrapJavaCommand::FinalPass()
     alldepends.push_back(res2);
     }
 
-  const char* no_output = 0;
   const char* no_working_directory = 0;
-  this->Makefile->AddUtilityCommand((this->LibraryName+"JavaClasses").c_str(),
-                                true, no_output, 
-                                alldepends, no_working_directory, "");
+  this->Makefile->AddUtilityCommand(
+    (this->LibraryName+"JavaClasses").c_str(),
+    true, alldepends, no_working_directory, "");
 }