Merge topic 'include-early-optional-handling'

8d9f39f4 include: Ask for permission, rather than forgiveness.
This commit is contained in:
Brad King 2015-04-28 13:55:55 -04:00 committed by CMake Topic Stage
commit 9de73d7ee5
1 changed files with 13 additions and 1 deletions

View File

@ -130,8 +130,20 @@ bool cmIncludeCommand
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 =
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
if (!resultVarName.empty())