summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-27 14:04:07 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-08-27 14:04:07 (GMT)
commit6904b6efdc2ea35c3490ba33cb352b03ea3085f5 (patch)
tree1108c7e561412f01acf5bfa744d526a8656ee47b
parenta97bb6ae3f70febd207ef2373287237249f082e5 (diff)
parent867b5be8b89c9b4f18ea604e1c61a154d0335c4c (diff)
downloadCMake-6904b6efdc2ea35c3490ba33cb352b03ea3085f5.zip
CMake-6904b6efdc2ea35c3490ba33cb352b03ea3085f5.tar.gz
CMake-6904b6efdc2ea35c3490ba33cb352b03ea3085f5.tar.bz2
Merge topic 'rm-cmLocalGenerator-Children'
867b5be8 cmLocalGenerator: Remove unused Children member. 6c832219 cmLocalGenerator: Implement child traversal in terms of cmState. 3fcf3837 Makefiles: Remove valueless cast. 223f4a66 cmLocalGenerator: Simplify condition. ae026f54 cmState: Store Children states in parent state.
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalGenerator.cxx36
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmState.cxx12
-rw-r--r--Source/cmState.h2
5 files changed, 34 insertions, 32 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 8c8c56e..92bef67 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -495,12 +495,12 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- for(std::vector<cmLocalGenerator*>::iterator sdi =
- lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
+ std::vector<cmState::Snapshot> children
+ = lg->GetMakefile()->GetStateSnapshot().GetChildren();
+ for(std::vector<cmState::Snapshot>::const_iterator
+ ci = children.begin(); ci != children.end(); ++ci)
{
- cmLocalUnixMakefileGenerator3* slg =
- static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
- std::string subdir = slg->GetMakefile()->GetCurrentBinaryDirectory();
+ std::string subdir = ci->GetDirectory().GetCurrentBinary();
subdir += "/";
subdir += pass;
depends.push_back(subdir);
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c2d1a7d..1e8fd3e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -50,10 +50,6 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
assert(snapshot.IsValid());
this->GlobalGenerator = gg;
this->Parent = parent;
- if (parent)
- {
- parent->AddChild(this);
- }
this->Makefile = new cmMakefile(this);
@@ -199,18 +195,16 @@ void cmLocalGenerator::GenerateTestFiles()
(*gi)->Compute(this);
(*gi)->Generate(fout, config, configurationTypes);
}
- if (!this->Children.empty())
+ size_t i;
+ std::vector<cmState::Snapshot> children
+ = this->Makefile->GetStateSnapshot().GetChildren();
+ for(i = 0; i < children.size(); ++i)
{
- size_t i;
- for(i = 0; i < this->Children.size(); ++i)
- {
- // TODO: Use add_subdirectory instead?
- fout << "subdirs(";
- std::string outP =
- this->Children[i]->GetMakefile()->GetCurrentBinaryDirectory();
- fout << this->Convert(outP,START_OUTPUT);
- fout << ")" << std::endl;
- }
+ // TODO: Use add_subdirectory instead?
+ fout << "subdirs(";
+ std::string outP = children[i].GetDirectory().GetCurrentBinary();
+ fout << this->Convert(outP,START_OUTPUT);
+ fout << ")" << std::endl;
}
}
@@ -416,16 +410,18 @@ void cmLocalGenerator::GenerateInstallRules()
this->GenerateTargetInstallRules(fout, config, configurationTypes);
// Include install scripts from subdirectories.
- if(!this->Children.empty())
+ std::vector<cmState::Snapshot> children
+ = this->Makefile->GetStateSnapshot().GetChildren();
+ if(!children.empty())
{
fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n";
- for(std::vector<cmLocalGenerator*>::const_iterator
- ci = this->Children.begin(); ci != this->Children.end(); ++ci)
+ for(std::vector<cmState::Snapshot>::const_iterator
+ ci = children.begin(); ci != children.end(); ++ci)
{
- if(!(*ci)->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ if(!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
{
- std::string odir = (*ci)->GetMakefile()->GetCurrentBinaryDirectory();
+ std::string odir = ci->GetDirectory().GetCurrentBinary();
cmSystemTools::ConvertToUnixSlashes(odir);
fout << " include(\"" << odir
<< "/cmake_install.cmake\")" << std::endl;
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1c18788..915814b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -89,11 +89,6 @@ public:
///! set/get the parent generator
cmLocalGenerator* GetParent() const {return this->Parent;}
- ///! set/get the children
- void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); }
- std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; }
-
-
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string&lang, const std::string& config);
@@ -349,7 +344,6 @@ protected:
cmState::Snapshot StateSnapshot;
cmGlobalGenerator *GlobalGenerator;
cmLocalGenerator* Parent;
- std::vector<cmLocalGenerator*> Children;
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 4e4c2c6..a401265 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -76,6 +76,8 @@ struct cmState::BuildsystemDirectoryStateType
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
cmPropertyMap Properties;
+
+ std::vector<cmState::Snapshot> Children;
};
cmState::cmState(cmake* cm)
@@ -274,6 +276,7 @@ cmState::Snapshot cmState::Reset()
it->CompileOptionsBacktraces.clear();
it->DirectoryEnd = pos;
it->Properties.clear();
+ it->Children.clear();
}
this->PolicyStack.Clear();
@@ -800,7 +803,9 @@ cmState::CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot,
pos->Parent = origin;
pos->Root = origin;
pos->Vars = this->VarTree.Extend(origin);
- return cmState::Snapshot(this, pos);
+ cmState::Snapshot snapshot = cmState::Snapshot(this, pos);
+ originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot);
+ return snapshot;
}
cmState::Snapshot
@@ -938,6 +943,11 @@ cmState::Snapshot::Snapshot(cmState* state)
{
}
+std::vector<cmState::Snapshot> cmState::Snapshot::GetChildren()
+{
+ return this->Position->BuildSystemDirectory->Children;
+}
+
cmState::Snapshot::Snapshot(cmState* state, PositionType position)
: State(state),
Position(position)
diff --git a/Source/cmState.h b/Source/cmState.h
index d683068..3099384 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -65,6 +65,8 @@ public:
void SetListFile(std::string const& listfile);
std::string GetExecutionListFile() const;
+
+ std::vector<Snapshot> GetChildren();
std::string GetEntryPointCommand() const;
long GetEntryPointLine() const;