include: Ask for permission, rather than forgiveness.
Check that a non-optional file exists before attempting to include it. This makes more sense than relying on an error case deeper within cmListFileCache.
This commit is contained in:
parent
dd062b2b50
commit
8d9f39f4c3
@ -130,8 +130,20 @@ bool cmIncludeCommand
|
|||||||
gg->GenerateImportFile(fname_abs);
|
gg->GenerateImportFile(fname_abs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string listFile =
|
||||||
|
cmSystemTools::CollapseFullPath(fname.c_str(),
|
||||||
|
this->Makefile->GetCurrentSourceDirectory());
|
||||||
|
if(optional && !cmSystemTools::FileExists(listFile.c_str()))
|
||||||
|
{
|
||||||
|
if (!resultVarName.empty())
|
||||||
|
{
|
||||||
|
this->Makefile->AddDefinition(resultVarName, "NOTFOUND");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool readit =
|
bool readit =
|
||||||
this->Makefile->ReadDependentFile(fname.c_str(), noPolicyScope);
|
this->Makefile->ReadDependentFile(listFile.c_str(), noPolicyScope);
|
||||||
|
|
||||||
// add the location of the included file if a result variable was given
|
// add the location of the included file if a result variable was given
|
||||||
if (!resultVarName.empty())
|
if (!resultVarName.empty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user