cmLocalGenerator: Port loops to cmState::Snapshot.
Make this code less dependent on being part of cmLocalGenerator, where it doesn't really belong.
This commit is contained in:
parent
48a9e91b02
commit
ed41a8e7b4
|
@ -2853,15 +2853,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmLocalGenerator::FindRelativePathTopSource()
|
std::string cmLocalGenerator::FindRelativePathTopSource()
|
||||||
{
|
{
|
||||||
cmLocalGenerator* gen = this;
|
cmState::Snapshot snapshot = this->StateSnapshot;
|
||||||
std::vector<cmLocalGenerator*> gens;
|
std::vector<cmState::Snapshot> snapshots;
|
||||||
gens.push_back(gen);
|
snapshots.push_back(snapshot);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
gen = gen->GetParent();
|
snapshot = snapshot.GetParent();
|
||||||
if (gen)
|
if (snapshot.IsValid())
|
||||||
{
|
{
|
||||||
gens.push_back(gen);
|
snapshots.push_back(snapshot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2869,13 +2869,12 @@ std::string cmLocalGenerator::FindRelativePathTopSource()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string result = gens.front()->StateSnapshot.GetCurrentSourceDirectory();
|
std::string result = snapshots.front().GetCurrentSourceDirectory();
|
||||||
|
|
||||||
for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
|
for (std::vector<cmState::Snapshot>::const_iterator it =
|
||||||
it != gens.end(); ++it)
|
snapshots.begin() + 1; it != snapshots.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string currentSource =
|
std::string currentSource = it->GetCurrentSourceDirectory();
|
||||||
(*it)->StateSnapshot.GetCurrentSourceDirectory();
|
|
||||||
if(cmSystemTools::IsSubDirectory(result, currentSource))
|
if(cmSystemTools::IsSubDirectory(result, currentSource))
|
||||||
{
|
{
|
||||||
result = currentSource;
|
result = currentSource;
|
||||||
|
@ -2888,15 +2887,15 @@ std::string cmLocalGenerator::FindRelativePathTopSource()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmLocalGenerator::FindRelativePathTopBinary()
|
std::string cmLocalGenerator::FindRelativePathTopBinary()
|
||||||
{
|
{
|
||||||
cmLocalGenerator* gen = this;
|
cmState::Snapshot snapshot = this->StateSnapshot;
|
||||||
std::vector<cmLocalGenerator*> gens;
|
std::vector<cmState::Snapshot> snapshots;
|
||||||
gens.push_back(gen);
|
snapshots.push_back(snapshot);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
gen = gen->GetParent();
|
snapshot = snapshot.GetParent();
|
||||||
if (gen)
|
if (snapshot.IsValid())
|
||||||
{
|
{
|
||||||
gens.push_back(gen);
|
snapshots.push_back(snapshot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2904,13 +2903,12 @@ std::string cmLocalGenerator::FindRelativePathTopBinary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string result = gens.front()->StateSnapshot.GetCurrentBinaryDirectory();
|
std::string result = snapshots.front().GetCurrentBinaryDirectory();
|
||||||
|
|
||||||
for (std::vector<cmLocalGenerator*>::const_iterator it = gens.begin() + 1;
|
for (std::vector<cmState::Snapshot>::const_iterator it =
|
||||||
it != gens.end(); ++it)
|
snapshots.begin() + 1; it != snapshots.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string currentBinary =
|
std::string currentBinary = it->GetCurrentBinaryDirectory();
|
||||||
(*it)->StateSnapshot.GetCurrentBinaryDirectory();
|
|
||||||
if(cmSystemTools::IsSubDirectory(result, currentBinary))
|
if(cmSystemTools::IsSubDirectory(result, currentBinary))
|
||||||
{
|
{
|
||||||
result = currentBinary;
|
result = currentBinary;
|
||||||
|
|
Loading…
Reference in New Issue