summaryrefslogtreecommitdiff
path: root/Source/cmDepends.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2012-09-30 17:53:01 +0200
committerBrad King <brad.king@kitware.com>2012-11-06 11:54:39 -0500
commite74ff7c29fc764af63ed3f5195ecc64730c07939 (patch)
tree9aca0b2d414e299638ecc803dddc7c6d438e9749 /Source/cmDepends.cxx
parentecc77d09b8996b59bf22bc36e06fa4bb52d665ee (diff)
downloadcmake-e74ff7c29fc764af63ed3f5195ecc64730c07939.tar.gz
cmDepends: allow multiple dependees per depender
This patch is heavily inspired by Michael Wild. The interfaces cmDepends::Write and cmDepends::WriteDependencies where extended to allow multiple dependees (sources) per depender (object). cmDepends::Write first collect all dependencies into a std::set before passing it to cmDepends::WriteDependencies. cmDependsC::WriteDependencies also first collects all explicit and implicit dependencies into a std::set and only then writes depend.{internal,make}. The implementation of cmDependsFortran simply loops over all sources and proceeds as before, whereas the cmDependsJava implementation is as trivial as before. This is for preventing exponential growth of depend.{internal,make} in the next commit which fixes dependency-vector erasure in cmDepends::CheckDependencies. Inspired-by: Michael Wild <themiwi@users.sourceforge.net>
Diffstat (limited to 'Source/cmDepends.cxx')
-rw-r--r--Source/cmDepends.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 166a584610..ebe8a68209 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -50,6 +50,7 @@ bool cmDepends::Write(std::ostream &makeDepends,
std::vector<std::string> pairs;
cmSystemTools::ExpandListArgument(srcStr, pairs);
+ std::map<std::string, std::set<std::string> > dependencies;
for(std::vector<std::string>::iterator si = pairs.begin();
si != pairs.end();)
{
@@ -62,9 +63,14 @@ bool cmDepends::Write(std::ostream &makeDepends,
obj = this->LocalGenerator->Convert(obj.c_str(),
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
+ dependencies[obj].insert(src);
+ }
+ for(std::map<std::string, std::set<std::string> >::const_iterator
+ it = dependencies.begin(); it != dependencies.end(); ++it)
+ {
// Write the dependencies for this pair.
- if(!this->WriteDependencies(src.c_str(), obj.c_str(),
+ if(!this->WriteDependencies(it->second, it->first,
makeDepends, internalDepends))
{
return false;
@@ -134,8 +140,9 @@ void cmDepends::Clear(const char *file)
}
//----------------------------------------------------------------------------
-bool cmDepends::WriteDependencies(const char*, const char*,
- std::ostream&, std::ostream&)
+bool cmDepends::WriteDependencies(
+ const std::set<std::string>&, const std::string&,
+ std::ostream&, std::ostream&)
{
// This should be implemented by the subclass.
return false;