Browse Source

stringapi: Use strings for dependency information

Ben Boeckel 11 years ago
parent
commit
7abf4e313d

+ 1 - 1
Source/cmFLTKWrapUICommand.cxx

@@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand
       commandLines.push_back(commandLine);
 
       // Add command for generating the .h and .cxx files
-      const char* no_main_dependency = 0;
+      std::string no_main_dependency = "";
       const char* no_comment = 0;
       const char* no_working_dir = 0;
       this->Makefile->AddCustomCommandToOutput(cxxres.c_str(),

+ 1 - 1
Source/cmGlobalVisualStudio8Generator.cxx

@@ -316,7 +316,7 @@ 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)
-  const char* no_main_dependency = 0;
+  std::string no_main_dependency = "";
   if(cmSourceFile* file =
      mf->AddCustomCommandToOutput(
        stamps, listFiles,

+ 1 - 1
Source/cmLocalGenerator.cxx

@@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
   this->Makefile->AddCustomCommandToOutput(
     targetFullPath.c_str(),
     objVector,
-    0,
+    "",
     commandLines,
     comment.c_str(),
     this->Makefile->GetStartOutputDirectory()

+ 1 - 1
Source/cmLocalVisualStudio6Generator.cxx

@@ -578,7 +578,7 @@ cmLocalVisualStudio6Generator
   std::string comment = this->ConstructComment(origCommand, "<hack>");
 
   // Add the rule with the given dependencies and commands.
-  const char* no_main_dependency = 0;
+  std::string no_main_dependency = "";
   if(cmSourceFile* outsf =
      this->Makefile->AddCustomCommandToOutput(
        output, depends, no_main_dependency,

+ 1 - 1
Source/cmLocalVisualStudio7Generator.cxx

@@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
       force_command.push_back(".");
       cmCustomCommandLines force_commands;
       force_commands.push_back(force_command);
-      const char* no_main_dependency = 0;
+      std::string no_main_dependency = "";
       std::string force = this->Makefile->GetStartOutputDirectory();
       force += cmake::GetCMakeFilesDirectory();
       force += "/";

+ 7 - 7
Source/cmMakefile.cxx

@@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
 cmSourceFile*
 cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
                                      const std::vector<std::string>& depends,
-                                     const char* main_dependency,
+                                     const std::string& main_dependency,
                                      const cmCustomCommandLines& commandLines,
                                      const char* comment,
                                      const char* workingDir,
@@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
 
   // Choose a source file on which to store the custom command.
   cmSourceFile* file = 0;
-  if(main_dependency && main_dependency[0])
+  if(!main_dependency.empty())
     {
     // The main dependency was specified.  Use it unless a different
     // custom command already used it.
@@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
 
   // Construct a complete list of dependencies.
   std::vector<std::string> depends2(depends);
-  if(main_dependency && main_dependency[0])
+  if(!main_dependency.empty())
     {
     depends2.push_back(main_dependency);
     }
@@ -1104,7 +1104,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output,
 cmSourceFile*
 cmMakefile::AddCustomCommandToOutput(const std::string& output,
                                      const std::vector<std::string>& depends,
-                                     const char* main_dependency,
+                                     const std::string& main_dependency,
                                      const cmCustomCommandLines& commandLines,
                                      const char* comment,
                                      const char* workingDir,
@@ -1123,7 +1123,7 @@ void
 cmMakefile::AddCustomCommandOldStyle(const std::string& target,
                                      const std::vector<std::string>& outputs,
                                      const std::vector<std::string>& depends,
-                                     const char* source,
+                                     const std::string& source,
                                      const cmCustomCommandLines& commandLines,
                                      const char* comment)
 {
@@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target,
     else
       {
       // The source may not be a real file.  Do not use a main dependency.
-      const char* no_main_dependency = 0;
+      std::string no_main_dependency = "";
       std::vector<std::string> depends2 = depends;
       depends2.push_back(source);
       sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
@@ -1251,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
   force += cmake::GetCMakeFilesDirectory();
   force += "/";
   force += utilityName;
-  const char* no_main_dependency = 0;
+  std::string no_main_dependency = "";
   bool no_replace = false;
   this->AddCustomCommandToOutput(force.c_str(), depends,
                                  no_main_dependency,

+ 3 - 3
Source/cmMakefile.h

@@ -177,7 +177,7 @@ public:
   cmSourceFile* AddCustomCommandToOutput(
     const std::vector<std::string>& outputs,
     const std::vector<std::string>& depends,
-    const char* main_dependency,
+    const std::string& main_dependency,
     const cmCustomCommandLines& commandLines,
     const char* comment, const char* workingDir,
     bool replace = false,
@@ -185,7 +185,7 @@ public:
   cmSourceFile* AddCustomCommandToOutput(
     const std::string& output,
     const std::vector<std::string>& depends,
-    const char* main_dependency,
+    const std::string& main_dependency,
     const cmCustomCommandLines& commandLines,
     const char* comment, const char* workingDir,
     bool replace = false,
@@ -193,7 +193,7 @@ public:
   void AddCustomCommandOldStyle(const std::string& target,
                                 const std::vector<std::string>& outputs,
                                 const std::vector<std::string>& depends,
-                                const char* source,
+                                const std::string& source,
                                 const cmCustomCommandLines& commandLines,
                                 const char* comment);
 

+ 4 - 6
Source/cmMakefileTargetGenerator.cxx

@@ -1496,8 +1496,9 @@ cmMakefileTargetGenerator
 }
 
 //----------------------------------------------------------------------------
-void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
-                                                      bool relink)
+void cmMakefileTargetGenerator::WriteTargetDriverRule(
+                                                const std::string& main_output,
+                                                bool relink)
 {
   // Compute the name of the driver target.
   std::string dir =
@@ -1510,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
 
   // Build the list of target outputs to drive.
   std::vector<std::string> depends;
-  if(main_output)
-    {
-    depends.push_back(main_output);
-    }
+  depends.push_back(main_output);
 
   const char* comment = 0;
   if(relink)

+ 1 - 1
Source/cmMakefileTargetGenerator.h

@@ -119,7 +119,7 @@ protected:
                            std::string::size_type limit = std::string::npos);
 
   // write the driver rule to build target outputs
-  void WriteTargetDriverRule(const char* main_output, bool relink);
+  void WriteTargetDriverRule(const std::string& main_output, bool relink);
 
   void DriveCustomCommands(std::vector<std::string>& depends);
 

+ 1 - 1
Source/cmQTWrapCPPCommand.cxx

@@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn,
       depends.push_back(moc_exe);
       depends.push_back(hname);
 
-      const char* no_main_dependency = 0;
+      std::string no_main_dependency = "";
       const char* no_working_dir = 0;
       this->Makefile->AddCustomCommandToOutput(newName.c_str(),
                                                depends,

+ 1 - 1
Source/cmQTWrapUICommand.cxx

@@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn,
 
       std::vector<std::string> depends;
       depends.push_back(uiName);
-      const char* no_main_dependency = 0;
+      std::string no_main_dependency = "";
       const char* no_comment = 0;
       const char* no_working_dir = 0;
       this->Makefile->AddCustomCommandToOutput(hName.c_str(),