From 7459ac30aa69d6fc5a0e0d2a0050b475e7af85d6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 22 Feb 2024 10:16:17 +0200 Subject: Detect dependency cycles in *.export.libs Fixes GH issue #362. --- libbuild2/cc/common.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libbuild2/cc/common.cxx') diff --git a/libbuild2/cc/common.cxx b/libbuild2/cc/common.cxx index 44722c4..2a8bc50 100644 --- a/libbuild2/cc/common.cxx +++ b/libbuild2/cc/common.cxx @@ -162,7 +162,12 @@ namespace build2 // Add the library to the chain. // if (self && proc_lib) + { + if (find (chain->begin (), chain->end (), &l) != chain->end ()) + fail << "dependency cycle detected involving library " << l; + chain->push_back (&l); + } // We only lookup public variables so go straight for the public // variable pool. -- cgit v1.1