فهرست منبع

Merge topic 'collect-genex-fix' into release-4.1

6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11322
Brad King 5 روز پیش
والد
کامیت
a2ebda45e2

+ 7 - 6
Source/cmGeneratorExpression.cxx

@@ -191,16 +191,17 @@ static std::string extractAllGeneratorExpressions(
           colons.push(c);
         }
       } else if (c[0] == '>') {
-        if (collected && !starts.empty() && !colons.empty()) {
-          (*collected)[std::string(starts.top() + 2, colons.top())].push_back(
-            std::string(colons.top() + 1, c));
+        if (!colons.empty() && !starts.empty() &&
+            starts.top() < colons.top()) {
+          if (collected) {
+            (*collected)[std::string(starts.top() + 2, colons.top())]
+              .push_back(std::string(colons.top() + 1, c));
+          }
+          colons.pop();
         }
         if (!starts.empty()) {
           starts.pop();
         }
-        if (!colons.empty()) {
-          colons.pop();
-        }
         if (starts.empty()) {
           break;
         }

+ 1 - 1
Tests/RunCMake/ExportPackageInfo/LinkInterfaceGeneratorExpression.cmake

@@ -2,7 +2,7 @@ project(LinkInterfaceGeneratorExpression CXX)
 
 add_library(foo foo.cxx)
 add_library(bar foo.cxx)
-target_link_libraries(bar $<1:foo>)
+target_link_libraries(bar $<1:foo> $<1:$<CONFIG>>)
 
 install(TARGETS foo EXPORT foo)
 export(EXPORT foo PACKAGE_INFO foo)

+ 4 - 0
Tests/RunCMake/string/GenexpStrip.cmake

@@ -35,3 +35,7 @@ test_strip( # Multiple case
   "1$<AND:1,0>2$<IF:$<$<BOOL:1>:$<CONFIG:RELEASE>>,TRUE,FALSE>3"
   "123"
 )
+test_strip( # No : inside of :
+  "$<1:$<SEMICOLON>>1"
+  "1"
+)