From 23a60d561cc322e6b12feab27cb1614c3fcb779c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 21 May 2008 19:57:35 -0400 Subject: [PATCH] BUG: Fix makefile generator to have link rules depend on all full path libraries that appear on the link line. This allows projects to relink when imported targets have changed. --- Source/cmMakefileTargetGenerator.cxx | 45 +++++----------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 05efc77ef..5e724d458 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -24,6 +24,7 @@ #include "cmSourceFile.h" #include "cmTarget.h" #include "cmake.h" +#include "cmComputeLinkInformation.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -1463,48 +1464,16 @@ void cmMakefileTargetGenerator { return; } - // Compute which library configuration to link. - cmTarget::LinkLibraryType linkType = cmTarget::OPTIMIZED; - if(cmSystemTools::UpperCase( - this->LocalGenerator->ConfigurationName.c_str()) == "DEBUG") - { - linkType = cmTarget::DEBUG; - } - // Keep track of dependencies already listed. - std::set emitted; - - // A target should not depend on itself. - emitted.insert(this->Target->GetName()); // Loop over all library dependencies. - const cmTarget::LinkLibraryVectorType& tlibs = - this->Target->GetLinkLibraries(); - for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin(); - lib != tlibs.end(); ++lib) + const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); + if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) { - // skip the library if it is not general and the link type - // does not match the current target - if(lib->second != cmTarget::GENERAL && - lib->second != linkType) + std::vector const& libDeps = cli->GetDepends(); + for(std::vector::const_iterator j = libDeps.begin(); + j != libDeps.end(); ++j) { - continue; - } - - // Don't emit the same library twice for this target. - if(emitted.insert(lib->first).second) - { - // Depend on other CMake targets. - if(cmTarget* tgt = - this->GlobalGenerator->FindTarget(0, lib->first.c_str())) - { - const char* config = this->LocalGenerator->ConfigurationName.c_str(); - depends.push_back(tgt->GetFullPath(config, false)); - } - // depend on full path libs as well - else if(cmSystemTools::FileIsFullPath(lib->first.c_str())) - { - depends.push_back(lib->first.c_str()); - } + depends.push_back(*j); } } }