]> git.tdb.fi Git - builder.git/blobdiff - source/binary.cpp
Collect libpath for static library dependencies from the libs themselves
[builder.git] / source / binary.cpp
index 079ae84995843d669f632789030e4bbb24bde69d..f3654f42f906767d2a41464117f3e2a52ceccb9b 100644 (file)
@@ -36,6 +36,8 @@ void Binary::collect_build_info(BuildInfo &binfo) const
                        binfo.update_from(obj_tool->get_build_info());
 
        Target::collect_build_info(binfo);
+
+       binfo.update_from(static_binfo);
 }
 
 void Binary::find_dependencies()
@@ -43,16 +45,19 @@ void Binary::find_dependencies()
        if(!component)
                return;
 
-       list<const Component *> queue;
+       list<Target *> queue;
        list<Target *> dep_libs;
        set<string> missing_libs;
-       queue.push_back(component);
+       queue.push_back(this);
        while(!queue.empty())
        {
-               queue.erase(queue.begin());
+               Target *tgt = queue.front();
+               queue.pop_front();
 
                BuildInfo binfo;
-               collect_build_info(binfo);
+               tgt->collect_build_info(binfo);
+               if(tgt!=this)
+                       static_binfo.libpath.insert(static_binfo.libpath.end(), binfo.libpath.begin(), binfo.libpath.end());
 
                for(BuildInfo::WordList::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
                {
@@ -67,8 +72,7 @@ void Binary::find_dependencies()
                                if(StaticLibrary *stlib = dynamic_cast<StaticLibrary *>(real))
                                {
                                        dep_libs.push_back(stlib);
-                                       if(stlib->get_component())
-                                               queue.push_back(stlib->get_component());
+                                       queue.push_back(stlib);
                                }
                                else
                                        dep_libs.push_back(lib);