BUG: Now only one makefile rule is generated per depenency. This eliminates

a number of warnings.
This commit is contained in:
Amitha Perera 2001-05-29 14:16:27 -04:00
parent bdfdfb73a2
commit dbf65f216f
1 changed files with 11 additions and 0 deletions

View File

@ -370,16 +370,23 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
// in this makefile will depend on. // in this makefile will depend on.
void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout) void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
{ {
// Each dependency should only be emitted once.
std::set<std::string> emitted;
fout << "CMAKE_DEPEND_LIBS = "; fout << "CMAKE_DEPEND_LIBS = ";
cmTarget::LinkLibraries& libs = m_Makefile->GetLinkLibraries(); cmTarget::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
cmTarget::LinkLibraries::const_iterator lib2; cmTarget::LinkLibraries::const_iterator lib2;
// Search the list of libraries that will be linked into // Search the list of libraries that will be linked into
// the executable // the executable
emitted.clear();
for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2) for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2)
{ {
// loop over the list of directories that the libraries might // loop over the list of directories that the libraries might
// be in, looking for an ADD_LIBRARY(lib...) line. This would // be in, looking for an ADD_LIBRARY(lib...) line. This would
// be stored in the cache // be stored in the cache
if( ! emitted.insert(lib2->first).second ) continue;
const char* cacheValue const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str()); = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
if(cacheValue) if(cacheValue)
@ -400,11 +407,15 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
} }
} }
fout << "\n\n"; fout << "\n\n";
emitted.clear();
for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2) for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2)
{ {
// loop over the list of directories that the libraries might // loop over the list of directories that the libraries might
// be in, looking for an ADD_LIBRARY(lib...) line. This would // be in, looking for an ADD_LIBRARY(lib...) line. This would
// be stored in the cache // be stored in the cache
if( ! emitted.insert(lib2->first).second ) continue;
const char* cacheValue const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str()); = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
if(cacheValue) if(cacheValue)