+Target *Builder::get_library(const string &lib, const Path::Path &path, unsigned mode)
+{
+ string full;
+ if(mode>=1)
+ {
+ full=(path/("lib"+lib+".a")).str();
+ Target *tgt=get_target(full);
+ // Targets can only be associated with buildable packages (or no package at all)
+ if(tgt && (tgt->get_package() || mode==2)) return tgt;
+ }
+ if(mode<=1)
+ {
+ full=(path/("lib"+lib+".so")).str();
+ Target *tgt=get_target(full);
+ if(tgt) return tgt;
+ }
+
+ if(Path::exists(full))
+ {
+ Target *tgt=new SystemLibrary(*this, full);
+ add_target(tgt);
+ return tgt;
+ }
+
+ return 0;
+}
+