ENH: Added dependencies between libraries.
This commit is contained in:
parent
22cc48c534
commit
6de0ff4b00
|
@ -1266,7 +1266,7 @@ cmLocalUnixMakefileGenerator2
|
||||||
{
|
{
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
|
|
||||||
// Build list of dependencies. TODO: depend on other targets.
|
// Build list of dependencies.
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
for(std::vector<std::string>::const_iterator obj = objects.begin();
|
for(std::vector<std::string>::const_iterator obj = objects.begin();
|
||||||
obj != objects.end(); ++obj)
|
obj != objects.end(); ++obj)
|
||||||
|
@ -1275,19 +1275,9 @@ cmLocalUnixMakefileGenerator2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add dependencies on libraries that will be linked.
|
// Add dependencies on libraries that will be linked.
|
||||||
std::set<cmStdString> emitted;
|
this->AppendLibDepends(target, depends);
|
||||||
emitted.insert(target.GetName());
|
|
||||||
const cmTarget::LinkLibraries& tlibs = target.GetLinkLibraries();
|
// Add a dependency on the rule file itself.
|
||||||
for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
|
|
||||||
lib != tlibs.end(); ++lib)
|
|
||||||
{
|
|
||||||
// Don't emit the same library twice for this target.
|
|
||||||
if(emitted.insert(lib->first).second)
|
|
||||||
{
|
|
||||||
// Add this dependency.
|
|
||||||
this->AppendLibDepend(depends, lib->first.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
depends.push_back(ruleFileName);
|
depends.push_back(ruleFileName);
|
||||||
|
|
||||||
// Construct the full path to the executable that will be generated.
|
// Construct the full path to the executable that will be generated.
|
||||||
|
@ -1500,13 +1490,18 @@ cmLocalUnixMakefileGenerator2
|
||||||
// code duplication.
|
// code duplication.
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
|
|
||||||
// Build list of dependencies. TODO: depend on other targets.
|
// Build list of dependencies.
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
for(std::vector<std::string>::const_iterator obj = objects.begin();
|
for(std::vector<std::string>::const_iterator obj = objects.begin();
|
||||||
obj != objects.end(); ++obj)
|
obj != objects.end(); ++obj)
|
||||||
{
|
{
|
||||||
depends.push_back(*obj);
|
depends.push_back(*obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add dependencies on libraries that will be linked.
|
||||||
|
this->AppendLibDepends(target, depends);
|
||||||
|
|
||||||
|
// Add a dependency on the rule file itself.
|
||||||
depends.push_back(ruleFileName);
|
depends.push_back(ruleFileName);
|
||||||
|
|
||||||
const char* linkLanguage =
|
const char* linkLanguage =
|
||||||
|
@ -1846,6 +1841,38 @@ void cmLocalUnixMakefileGenerator2::AppendFlags(std::string& flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void
|
||||||
|
cmLocalUnixMakefileGenerator2
|
||||||
|
::AppendLibDepends(const cmTarget& target,
|
||||||
|
std::vector<std::string>& depends)
|
||||||
|
{
|
||||||
|
// Do not bother with dependencies for static libraries.
|
||||||
|
if(target.GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep track of dependencies already listed.
|
||||||
|
std::set<cmStdString> emitted;
|
||||||
|
|
||||||
|
// A target should not depend on itself.
|
||||||
|
emitted.insert(target.GetName());
|
||||||
|
|
||||||
|
// Loop over all dependencies.
|
||||||
|
const cmTarget::LinkLibraries& tlibs = target.GetLinkLibraries();
|
||||||
|
for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
|
||||||
|
lib != tlibs.end(); ++lib)
|
||||||
|
{
|
||||||
|
// Don't emit the same library twice for this target.
|
||||||
|
if(emitted.insert(lib->first).second)
|
||||||
|
{
|
||||||
|
// Add this dependency.
|
||||||
|
this->AppendLibDepend(depends, lib->first.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmLocalUnixMakefileGenerator2
|
cmLocalUnixMakefileGenerator2
|
||||||
|
|
|
@ -124,6 +124,8 @@ protected:
|
||||||
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
void AddSharedFlags(std::string& flags, const char* lang, bool shared);
|
||||||
void AddConfigVariableFlags(std::string& flags, const char* var);
|
void AddConfigVariableFlags(std::string& flags, const char* var);
|
||||||
void AppendFlags(std::string& flags, const char* newFlags);
|
void AppendFlags(std::string& flags, const char* newFlags);
|
||||||
|
void AppendLibDepends(const cmTarget& target,
|
||||||
|
std::vector<std::string>& depends);
|
||||||
void AppendLibDepend(std::vector<std::string>& depends, const char* name);
|
void AppendLibDepend(std::vector<std::string>& depends, const char* name);
|
||||||
std::string GetRecursiveMakeCall(const char* tgt, bool silent);
|
std::string GetRecursiveMakeCall(const char* tgt, bool silent);
|
||||||
void WriteJumpAndBuildRules(std::ostream& makefileStream);
|
void WriteJumpAndBuildRules(std::ostream& makefileStream);
|
||||||
|
|
Loading…
Reference in New Issue