Browse Source

add HasOnlyEmptyCommandLines() method to cmCustomCommandGenerator

Michael Stürmer 8 years ago
parent
commit
34c4108bbc
2 changed files with 13 additions and 0 deletions
  1. 12 0
      Source/cmCustomCommandGenerator.cxx
  2. 1 0
      Source/cmCustomCommandGenerator.h

+ 12 - 0
Source/cmCustomCommandGenerator.cxx

@@ -97,6 +97,18 @@ const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const
   return nullptr;
 }
 
+bool cmCustomCommandGenerator::HasOnlyEmptyCommandLines() const
+{
+  for (size_t i = 0; i < this->CommandLines.size(); ++i) {
+    for (size_t j = 0; j < this->CommandLines[i].size(); ++j) {
+      if (!this->CommandLines[i][j].empty()) {
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
 std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
 {
   if (const char* emulator = this->GetCrossCompilingEmulator(c)) {

+ 1 - 0
Source/cmCustomCommandGenerator.h

@@ -40,6 +40,7 @@ public:
   std::vector<std::string> const& GetOutputs() const;
   std::vector<std::string> const& GetByproducts() const;
   std::vector<std::string> const& GetDepends() const;
+  bool HasOnlyEmptyCommandLines() const;
 };
 
 #endif