summaryrefslogtreecommitdiffstats
path: root/Source/cmDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-12-23 03:41:42 (GMT)
committerBrad King <brad.king@kitware.com>2007-12-23 03:41:42 (GMT)
commit4d360f7ac56939ede629e368fb282d4022f69d6c (patch)
treec4ba214154fa085fe06dfbf17d080e41661ee48d /Source/cmDepends.cxx
parenta7245e47925f51b8b648b1eb075f3ecec2b5ce76 (diff)
downloadCMake-4d360f7ac56939ede629e368fb282d4022f69d6c.zip
CMake-4d360f7ac56939ede629e368fb282d4022f69d6c.tar.gz
CMake-4d360f7ac56939ede629e368fb282d4022f69d6c.tar.bz2
ENH: Convert cmDepends object interface to scan an entire target at once.
Diffstat (limited to 'Source/cmDepends.cxx')
-rw-r--r--Source/cmDepends.cxx37
1 files changed, 34 insertions, 3 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 93beee6..327f508 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -16,6 +16,8 @@
=========================================================================*/
#include "cmDepends.h"
+#include "cmLocalGenerator.h"
+#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
#include "cmSystemTools.h"
#include "cmFileTimeComparison.h"
@@ -41,10 +43,39 @@ cmDepends::~cmDepends()
}
//----------------------------------------------------------------------------
-bool cmDepends::Write(const char *src, const char *obj,
- std::ostream &makeDepends, std::ostream &internalDepends)
+bool cmDepends::Write(std::ostream &makeDepends,
+ std::ostream &internalDepends)
{
- return this->WriteDependencies(src, obj, makeDepends, internalDepends);
+ // Lookup the set of sources to scan.
+ std::string srcLang = "CMAKE_DEPENDS_CHECK_";
+ srcLang += this->Language;
+ cmMakefile* mf = this->LocalGenerator->GetMakefile();
+ const char* srcStr = mf->GetSafeDefinition(srcLang.c_str());
+ std::vector<std::string> pairs;
+ cmSystemTools::ExpandListArgument(srcStr, pairs);
+
+ for(std::vector<std::string>::iterator si = pairs.begin();
+ si != pairs.end();)
+ {
+ // Get the source and object file.
+ std::string const& src = *si++;
+ if(si == pairs.end()) { break; }
+ std::string obj = *si++;
+
+ // Make sure the object file is relative to the top of the build tree.
+ obj = this->LocalGenerator->Convert(obj.c_str(),
+ cmLocalGenerator::HOME_OUTPUT,
+ cmLocalGenerator::MAKEFILE);
+
+ // Write the dependencies for this pair.
+ if(!this->WriteDependencies(src.c_str(), obj.c_str(),
+ makeDepends, internalDepends))
+ {
+ return false;
+ }
+ }
+
+ return true;
}
//----------------------------------------------------------------------------