diff options
author | Amitha Perera <perera@cs.rpi.edu> | 2002-05-02 17:41:40 (GMT) |
---|---|---|
committer | Amitha Perera <perera@cs.rpi.edu> | 2002-05-02 17:41:40 (GMT) |
commit | 4fe8947bcc725396a6bb85720c6836d81d100dd7 (patch) | |
tree | fe7d2ded8e16953035b07350dfca290805e84a92 /Source/cmTarget.cxx | |
parent | 27fe57b716555ffa31b16e98841c7f1a82228740 (diff) | |
download | CMake-4fe8947bcc725396a6bb85720c6836d81d100dd7.zip CMake-4fe8947bcc725396a6bb85720c6836d81d100dd7.tar.gz CMake-4fe8947bcc725396a6bb85720c6836d81d100dd7.tar.bz2 |
BUG: The library paths should stay with the libraries during dependency analysis.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8b12ab0..59900da 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -103,11 +103,15 @@ bool cmTarget::HasCxx() const void cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) { - typedef std::map< std::string, std::pair<std::string,LinkLibraryType> > LibMap; typedef std::vector< std::string > LinkLine; // Maps the canonical names to the full objects of m_LinkLibraries. - LibMap lib_map; + LibTypeMap lib_map; + + // The unique list of libraries on the orginal link line. They + // correspond to lib_map keys. However, lib_map will also get + // further populated by the dependency analysis. + LinkLine orig_libs; // The list canonical names in the order they were orginally // specified on the link line (m_LinkLibraries). @@ -124,15 +128,19 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) if (lib->first.size() == 0) continue; std::string cname = CanonicalLibraryName(lib->first); - lib_map[ cname ] = *lib; lib_order.push_back( cname ); + if( lib_map.end() == lib_map.find( cname ) ) + { + lib_map[ cname ] = *lib; + orig_libs.push_back( cname ); + } } // First, get the explicit dependencies for those libraries that // have specified them - for( LibMap::iterator i = lib_map.begin(); i != lib_map.end(); ++i ) + for( LinkLine::iterator i = orig_libs.begin(); i != orig_libs.end(); ++i ) { - GatherDependencies( mf, i->first, dep_map ); + GatherDependencies( mf, *i, dep_map, lib_map ); } // For the rest, get implicit dependencies. A library x depends @@ -146,20 +154,20 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) // [*1] This prevents external libraries from depending on libraries // generated by this project. - for( LibMap::iterator i = lib_map.begin(); i != lib_map.end(); ++i ) + for( LinkLine::iterator i = orig_libs.begin(); i != orig_libs.end(); ++i ) { - if( dep_map.find( i->first ) == dep_map.end() ) + if( dep_map.find( *i ) == dep_map.end() ) { - LinkLine::iterator pos = std::find( lib_order.begin(), lib_order.end(), i->first ); + LinkLine::iterator pos = std::find( lib_order.begin(), lib_order.end(), *i ); for( ; pos != lib_order.end(); ++pos ) { std::set<std::string> visited; - if( !DependsOn( *pos, i->first, dep_map, visited ) ) + if( !DependsOn( *pos, *i, dep_map, visited ) ) { - dep_map_implicit[ i->first ].insert( *pos ); + dep_map_implicit[ *i ].insert( *pos ); } } - dep_map_implicit[ i->first ].erase( i->first ); // cannot depend on itself + dep_map_implicit[ *i ].erase( *i ); // cannot depend on itself } } @@ -175,9 +183,9 @@ cmTarget::AnalyzeLibDependencies( const cmMakefile& mf ) // Create a new link line order. std::set<std::string> done, visited; std::vector<std::string> link_line; - for( LibMap::iterator i = lib_map.begin(); i != lib_map.end(); ++i ) + for( LinkLine::iterator i = orig_libs.begin(); i != orig_libs.end(); ++i ) { - Emit( i->first, dep_map, done, visited, link_line ); + Emit( *i, dep_map, done, visited, link_line ); } @@ -295,7 +303,8 @@ void cmTarget::Emit( const std::string& lib, void cmTarget::GatherDependencies( const cmMakefile& mf, const std::string& lib, - DependencyMap& dep_map ) const + DependencyMap& dep_map, + LibTypeMap& lib_map ) const { // If the library is already in the dependency map, then it has // already been fully processed. @@ -322,8 +331,9 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, if( l.size() != 0 ) { const std::string cname = CanonicalLibraryName(l); + lib_map[ cname ] = std::make_pair(l,GENERAL); // ** FIXME: we need to store the correct type here dep_map[ lib ].insert( cname ); - GatherDependencies( mf, cname, dep_map ); + GatherDependencies( mf, cname, dep_map, lib_map ); } start = end+1; // skip the ; end = depline.find( ";", start ); |