summaryrefslogtreecommitdiffstats
path: root/Source/cmGraphVizWriter.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2010-11-14 18:37:03 (GMT)
committerAlex Neundorf <neundorf@kde.org>2010-11-14 18:37:03 (GMT)
commit5ea1e4cb36d813bcb1377637779a54f18411763b (patch)
tree78eaa1d9ee77ccad958fc243dfd10ffb14855257 /Source/cmGraphVizWriter.cxx
parent2a5790a080d86c63daf3d2c17d533c919cbef582 (diff)
downloadCMake-5ea1e4cb36d813bcb1377637779a54f18411763b.zip
CMake-5ea1e4cb36d813bcb1377637779a54f18411763b.tar.gz
CMake-5ea1e4cb36d813bcb1377637779a54f18411763b.tar.bz2
Collect targets and libs on demand instead of in the ctor
This is necessary for the next commit which requires that the targets are collected after the settings have been read. Alex
Diffstat (limited to 'Source/cmGraphVizWriter.cxx')
-rw-r--r--Source/cmGraphVizWriter.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 94918a5..00befec 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -55,9 +55,8 @@ cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
,GenerateForSharedLibs(true)
,GenerateForModuleLibs(true)
,LocalGenerators(localGenerators)
+,HaveTargetsAndLibs(false)
{
- int cnt = collectAllTargets();
- collectAllExternalLibs(cnt);
}
@@ -137,6 +136,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{
+ this->CollectTargetsAndLibs();
+
for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end();
@@ -177,6 +178,8 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
{
+ this->CollectTargetsAndLibs();
+
cmGeneratedFileStream str(fileName);
if ( !str )
{
@@ -295,7 +298,18 @@ void cmGraphVizWriter::WriteNode(const char* targetName,
}
-int cmGraphVizWriter::collectAllTargets()
+void cmGraphVizWriter::CollectTargetsAndLibs()
+{
+ if (this->HaveTargetsAndLibs == false)
+ {
+ this->HaveTargetsAndLibs = true;
+ int cnt = this->CollectAllTargets();
+ this->CollectAllExternalLibs(cnt);
+ }
+}
+
+
+int cmGraphVizWriter::CollectAllTargets()
{
int cnt = 0;
// First pass get the list of all cmake targets
@@ -327,7 +341,7 @@ int cmGraphVizWriter::collectAllTargets()
}
-int cmGraphVizWriter::collectAllExternalLibs(int cnt)
+int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
{
// Ok, now find all the stuff we link to that is not in cmake
for (std::vector<cmLocalGenerator*>::const_iterator lit =