cmGlobalGenerator: Port Find API to cmMakefile.
This commit is contained in:
parent
c5b8841fd9
commit
5f66900e71
|
@ -51,10 +51,8 @@ bool cmGetDirectoryPropertyCommand
|
|||
sd = cmSystemTools::CollapseFullPath(sd);
|
||||
|
||||
// lookup the makefile from the directory name
|
||||
cmLocalGenerator *lg =
|
||||
this->Makefile->GetGlobalGenerator()->
|
||||
FindLocalGenerator(sd);
|
||||
if (!lg)
|
||||
dir = this->Makefile->GetGlobalGenerator()->FindMakefile(sd);
|
||||
if (!dir)
|
||||
{
|
||||
this->SetError
|
||||
("DIRECTORY argument provided but requested directory not found. "
|
||||
|
@ -62,7 +60,6 @@ bool cmGetDirectoryPropertyCommand
|
|||
"it is valid but has not been processed yet.");
|
||||
return false;
|
||||
}
|
||||
dir = lg->GetMakefile();
|
||||
++i;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,13 +262,8 @@ bool cmGetPropertyCommand::HandleDirectoryMode()
|
|||
dir = cmSystemTools::CollapseFullPath(dir);
|
||||
|
||||
// Lookup the generator.
|
||||
if(cmLocalGenerator* lg =
|
||||
(this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir)))
|
||||
{
|
||||
// Use the makefile for the directory found.
|
||||
mf = lg->GetMakefile();
|
||||
}
|
||||
else
|
||||
mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir);
|
||||
if (!mf)
|
||||
{
|
||||
// Could not find the directory.
|
||||
this->SetError
|
||||
|
|
|
@ -2160,6 +2160,20 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
|
|||
}
|
||||
}
|
||||
|
||||
cmMakefile*
|
||||
cmGlobalGenerator::FindMakefile(const std::string& start_dir) const
|
||||
{
|
||||
for(std::vector<cmMakefile*>::const_iterator it =
|
||||
this->Makefiles.begin(); it != this->Makefiles.end(); ++it)
|
||||
{
|
||||
std::string sd = (*it)->GetCurrentSourceDirectory();
|
||||
if (sd == start_dir)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///! Find a local generator by its startdirectory
|
||||
cmLocalGenerator*
|
||||
|
|
|
@ -256,6 +256,7 @@ public:
|
|||
that is a framework. */
|
||||
bool NameResolvesToFramework(const std::string& libname) const;
|
||||
|
||||
cmMakefile* FindMakefile(const std::string& start_dir) const;
|
||||
///! Find a local generator by its startdirectory
|
||||
cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const;
|
||||
|
||||
|
|
|
@ -205,14 +205,8 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
|
|||
// The local generators are associated with collapsed paths.
|
||||
dir = cmSystemTools::CollapseFullPath(dir);
|
||||
|
||||
// Lookup the generator.
|
||||
if(cmLocalGenerator* lg =
|
||||
this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir))
|
||||
{
|
||||
// Use the makefile for the directory found.
|
||||
mf = lg->GetMakefile();
|
||||
}
|
||||
else
|
||||
mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir);
|
||||
if (!mf)
|
||||
{
|
||||
// Could not find the directory.
|
||||
this->SetError
|
||||
|
|
Loading…
Reference in New Issue