+ BuildInfo::LibraryMode libmode = component->get_build_info().get_libmode_for(l);
+ Target *lib = builder.get_vfs().find_library(l, binfo.libpath, libmode);
+ if(lib)
+ {
+ Target *real = lib->get_real_target();
+ if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(real))
+ {
+ /* Keep only the last occurrence of each static library. This
+ ensures the order is correct for linking. */
+ auto i = find(static_libs, stlib);
+ if(i!=static_libs.end())
+ static_libs.erase(i);
+ static_libs.push_back(stlib);
+ find_dependencies(stlib, static_libs, shared_libs, missing_libs);
+ }
+ else if(!any_equals(shared_libs, lib))
+ shared_libs.push_back(lib);
+ }
+ else if(!any_equals(missing_libs, l))
+ missing_libs.push_back(l);
+ }