- if(FileTarget *tgt = get_target(fn))
- return tgt;
- else
- return new StaticLibrary(builder, fn);
+ bool shared = true;
+ for(list<string>::const_iterator j=shared_names.begin(); j!=static_names.end(); )
+ {
+ if(j==shared_names.end())
+ {
+ j = static_names.begin();
+ shared = false;
+ continue;
+ }
+
+ FS::Path filename = *i / *j;
+ if(FileTarget *tgt = get_target(filename))
+ {
+ if(!shared || mode==DYNAMIC || !tgt->get_package())
+ {
+ builder.get_logger().log("vfs", format("Library %s (%s) found in %s as existing %s", lib, *j, i->str(), tgt->get_type()));
+ return tgt;
+ }
+ }
+ else if(file_exists(filename))
+ {
+ builder.get_logger().log("vfs", format("Library %s (%s) found in %s", lib, *j, i->str()));
+ if(shared)
+ return new SharedLibrary(builder, filename);
+ else
+ return new StaticLibrary(builder, filename);
+ }
+
+ ++j;
+ }
+
+ builder.get_logger().log("vfs", format("Library %s not found in %s", lib, i->str()));