diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 40b0d451a..3afce3dbd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -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::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)); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 04c9a4cc0..ee5071da4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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