]> git.tdb.fi Git - builder.git/blobdiff - source/component.cpp
An include directory is needed as well
[builder.git] / source / component.cpp
index feb5094b27a071fa8823eabd4e09c2fae466a11d..8a57b6410ee47024cec0b88704f9998707130a4b 100644 (file)
@@ -68,6 +68,19 @@ void Component::create_build_info()
        final_build_info.update_from(build_info);
        build_info = final_build_info;
 
+       for(UseList::const_iterator i=uses.begin(); i!=uses.end(); ++i)
+       {
+               /* Select an include path that contains all the sources for this and the
+               used component.  This should produce a sensible result in most cases. */
+               FS::Path base;
+               for(SourceList::const_iterator j=sources.begin(); j!=sources.end(); ++j)
+                       base = base.empty() ? *j : FS::common_ancestor(base, *j);
+               const SourceList &use_sources = (*i)->get_sources();
+               for(SourceList::const_iterator j=use_sources.begin(); j!=use_sources.end(); ++j)
+                       base = FS::common_ancestor(base, *j);
+               build_info.incpath.push_back(base);
+       }
+
        if(type==LIBRARY || type==MODULE)
                if(build_info.libmode<BuildInfo::DYNAMIC)
                        build_info.libmode = BuildInfo::DYNAMIC;