diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-06-05 16:02:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-06-05 16:02:24 +0200 |
commit | a85abe131b86893b97ee917cdb282d1624468b10 (patch) | |
tree | 1277ef129c5b47e643c0f2f4c69f62dddea1efb8 /libbuild2 | |
parent | 3818ed57cdaf2a655c97cbf671c1617f4178659d (diff) |
Improve -rpath duplicate suppression logic even more
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/cc/link-rule.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 93b2715..96b9898 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -3351,6 +3351,9 @@ namespace build2 origin = p.directory (); } + // Note: suppress duplicates at the options level, similar to + // rpath_libraries(). + bool origin_used (false); for (const dir_path& p: cast<dir_paths> (l)) { @@ -3387,7 +3390,8 @@ namespace build2 else o += p.string (); - sargs.push_back (move (o)); + if (find (sargs.begin (), sargs.end (), o) == sargs.end ()) + sargs.push_back (move (o)); } // According to the Internet, `-Wl,-z,origin` is not needed except @@ -3405,7 +3409,12 @@ namespace build2 fail << ctgt << " does not support rpath-link"; for (const dir_path& p: cast<dir_paths> (l)) - sargs.push_back ("-Wl,-rpath-link," + p.string ()); + { + string o ("-Wl,-rpath-link," + p.string ()); + + if (find (sargs.begin (), sargs.end (), o) == sargs.end ()) + sargs.push_back (move (o)); + } } } |