瀏覽代碼

ENH: Allow LIST(APPEND) command to append nothing.

Brad King 18 年之前
父節點
當前提交
a06dcdba97
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      Source/cmListCommand.cxx

+ 8 - 2
Source/cmListCommand.cxx

@@ -179,12 +179,18 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args)
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
 bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
 {
 {
-  if(args.size() < 3)
+  if(args.size() < 2)
     {
     {
-    this->SetError("sub-command APPEND requires at least two arguments.");
+    this->SetError("sub-command APPEND requires at least one argument.");
     return false;
     return false;
     }
     }
 
 
+  // Skip if nothing to append.
+  if(args.size() < 3)
+    {
+    return true;
+    }
+
   const std::string& listName = args[1];
   const std::string& listName = args[1];
   // expand the variable
   // expand the variable
   std::string listString;
   std::string listString;