Browse Source

Ninja Multi-Config: Fix internal cross-config target dependency ordering

In commit 7abc3d61ac (Ninja Multi-Config: Fix issue with framework
dependencies and Autogen, 2020-02-13, v3.17.0-rc2~18^2) the `cmLinkItem`
comparison operator was updated to order identical strings by the
cross-config boolean.  We need to order identical targets that way too
in order to represent both a cross and non-cross dependency on the same
target.

Issue: #22855
Brad King 4 years ago
parent
commit
a883363935
1 changed files with 8 additions and 4 deletions
  1. 8 4
      Source/cmLinkItem.cxx

+ 8 - 4
Source/cmLinkItem.cxx

@@ -32,7 +32,11 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r)
 {
   // Order among targets.
   if (l.Target && r.Target) {
-    return l.Target < r.Target;
+    if (l.Target != r.Target) {
+      return l.Target < r.Target;
+    }
+    // Order identical targets via cross-config.
+    return l.Cross < r.Cross;
   }
   // Order targets before strings.
   if (l.Target) {
@@ -42,10 +46,10 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r)
     return false;
   }
   // Order among strings.
-  if (l.String < r.String) {
-    return true;
+  if (l.String != r.String) {
+    return l.String < r.String;
   }
-  // Order among cross-config.
+  // Order identical strings via cross-config.
   return l.Cross < r.Cross;
 }