Ver código fonte

ENH: Return utility target after creation

After creating a utility target with AddUtilityCommand, return a pointer
to the cmTarget instance so the caller may further modify the target as
needed.
Brad King 17 anos atrás
pai
commit
0ad5eb177b
2 arquivos alterados com 14 adições e 12 exclusões
  1. 8 6
      Source/cmMakefile.cxx
  2. 6 6
      Source/cmMakefile.h

+ 8 - 6
Source/cmMakefile.cxx

@@ -982,12 +982,13 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
 }
 
 //----------------------------------------------------------------------------
-void cmMakefile::AddUtilityCommand(const char* utilityName,
-                                   bool excludeFromAll,
-                                   const char* workingDirectory,
-                                   const std::vector<std::string>& depends,
-                                   const cmCustomCommandLines& commandLines,
-                                   bool escapeOldStyle, const char* comment)
+cmTarget*
+cmMakefile::AddUtilityCommand(const char* utilityName,
+                              bool excludeFromAll,
+                              const char* workingDirectory,
+                              const std::vector<std::string>& depends,
+                              const cmCustomCommandLines& commandLines,
+                              bool escapeOldStyle, const char* comment)
 {
   // Create a target instance for this utility.
   cmTarget* target = this->AddNewTarget(cmTarget::UTILITY, utilityName);
@@ -1025,6 +1026,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName,
     cmSystemTools::Error("Could not get source file entry for ",
                          force.c_str());
     }
+  return target;
 }
 
 void cmMakefile::AddDefineFlag(const char* flag)

+ 6 - 6
Source/cmMakefile.h

@@ -200,12 +200,12 @@ public:
                          const char* arg2=0,
                          const char* arg3=0,
                          const char* arg4=0);
-  void AddUtilityCommand(const char* utilityName, bool excludeFromAll,
-                         const char* workingDirectory,
-                         const std::vector<std::string>& depends,
-                         const cmCustomCommandLines& commandLines,
-                         bool escapeOldStyle = true,
-                         const char* comment = 0);
+  cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll,
+                              const char* workingDirectory,
+                              const std::vector<std::string>& depends,
+                              const cmCustomCommandLines& commandLines,
+                              bool escapeOldStyle = true,
+                              const char* comment = 0);
 
   /**
    * Add a link library to the build.