瀏覽代碼

Fix the cmGeneratorExpression::Split when leading chars are present.

In the case of input like

 foo$<1:bar>

the preGenex should be 'foo'. In that case, the search for a ';'
will not find one, and there is no preceding input to process as a
non-genex list.

Previously, the result of 'splitting' such a string would instead
be a vector containing the same string two times.
Stephen Kelly 12 年之前
父節點
當前提交
f93a388c9c
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10 2
      Source/cmGeneratorExpression.cxx

+ 10 - 2
Source/cmGeneratorExpression.cxx

@@ -302,12 +302,20 @@ void cmGeneratorExpression::Split(const std::string &input,
     if (!part.empty())
       {
       std::string::size_type startPos = input.rfind(";", pos);
-      if (startPos != pos - 1 && startPos >= lastPos)
+      if (startPos == std::string::npos)
+        {
+        preGenex = part;
+        part = "";
+        }
+      else if (startPos != pos - 1 && startPos >= lastPos)
         {
         part = input.substr(lastPos, startPos - lastPos);
         preGenex = input.substr(startPos + 1, pos - startPos - 1);
         }
-      cmSystemTools::ExpandListArgument(part.c_str(), output);
+      if(!part.empty())
+        {
+        cmSystemTools::ExpandListArgument(part.c_str(), output);
+        }
       }
     pos += 2;
     int nestingLevel = 1;