ENH: only add _LIB_DEPEND information for libraries and modules

This commit is contained in:
Bill Hoffman 2002-06-03 10:25:55 -04:00
parent 993aebb748
commit e5668ea656
2 changed files with 27 additions and 14 deletions

View File

@ -659,6 +659,14 @@ void cmMakefile::SetProjectName(const char* p)
void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
{
// for these targets do not add anything
switch(target.GetType())
{
case cmTarget::UTILITY:
case cmTarget::INSTALL_FILES:
case cmTarget::INSTALL_PROGRAMS:
return;
}
std::vector<std::string>::iterator j;
for(j = m_LinkDirectories.begin();
j != m_LinkDirectories.end(); ++j)
@ -766,7 +774,6 @@ void cmMakefile::AddExecutable(const char *exeName,
target.SetInAll(true);
target.GetSourceLists() = srcs;
this->AddGlobalLinkInformation(exeName, target);
m_Targets.insert(cmTargets::value_type(exeName,target));

View File

@ -134,21 +134,27 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
// simply a set of libraries separated by ";". There should always
// be a trailing ";". These library names are not canonical, in that
// they may be "-framework x", "-ly", "/path/libz.a", etc.
std::string targetEntry = target;
targetEntry += "_LIB_DEPENDS";
std::string dependencies;
const char* old_val = mf.GetDefinition( targetEntry.c_str() );
if( old_val )
// only add depend information for library targets
if(m_TargetType >= STATIC_LIBRARY && m_TargetType <= MODULE_LIBRARY)
{
dependencies += old_val;
std::string targetEntry = target;
targetEntry += "_LIB_DEPENDS";
std::string dependencies;
const char* old_val = mf.GetDefinition( targetEntry.c_str() );
if( old_val )
{
dependencies += old_val;
}
if( dependencies.find( lib ) == std::string::npos )
{
dependencies += lib;
dependencies += ";";
}
mf.AddCacheDefinition( targetEntry.c_str(), dependencies.c_str(),
"Dependencies for the target",
cmCacheManager::STATIC );
}
if( dependencies.find( lib ) == std::string::npos )
{
dependencies += lib;
dependencies += ";";
}
mf.AddCacheDefinition( targetEntry.c_str(), dependencies.c_str(),
"Dependencies for the target", cmCacheManager::STATIC );
}
bool cmTarget::HasCxx() const