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.
This commit is contained in:
parent
40d06f542c
commit
23a60d561c
|
@ -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<cmStdString> 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<std::string> const& libDeps = cli->GetDepends();
|
||||
for(std::vector<std::string>::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue