ENH: cmMakeDepend::GenerateDependInformation will now use hints regardless of whether the actual file exists. This can be used to add dependencies to .h files which are generated but included in hand-written .cxx files. If the .cxx does exist, though, it will be used first, and the hints will be used afterward.

This commit is contained in:
Brad King 2001-11-12 15:37:38 -05:00
parent 668974b01c
commit 5231ad0c7e
1 changed files with 19 additions and 14 deletions

View File

@ -129,16 +129,18 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
return;
}
bool found = false;
// If the file exists, use it to find dependency information.
if(cmSystemTools::FileExists(path))
{
// Use the real file to find its dependencies.
this->DependWalk(info);
return;
found = true;
}
// The file doesn't exist. See if the cmSourceFile for it has any files
// specified as dependency hints.
// See if the cmSourceFile for it has any files specified as
// dependency hints.
if(info->m_cmSourceFile != 0)
{
// Get the cmSourceFile corresponding to this.
@ -147,7 +149,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
// file.
if(!cFile.GetDepends().empty())
{
// Initial dependencies have been given. Use them to begin the
// Dependency hints have been given. Use them to begin the
// recursion.
for(std::vector<std::string>::const_iterator file =
cFile.GetDepends().begin(); file != cFile.GetDepends().end();
@ -157,21 +159,24 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
}
// Found dependency information. We are done.
return;
found = true;
}
}
// Couldn't find any dependency information.
if(m_ComplainFileRegularExpression.find(info->m_IncludeName.c_str()))
if(!found)
{
cmSystemTools::Error("error cannot find dependencies for ", path);
// Couldn't find any dependency information.
if(m_ComplainFileRegularExpression.find(info->m_IncludeName.c_str()))
{
cmSystemTools::Error("error cannot find dependencies for ", path);
}
else
{
// Destroy the name of the file so that it won't be output as a
// dependency.
info->m_FullPath = "";
}
}
else
{
// Destroy the name of the file so that it won't be output as a
// dependency.
info->m_FullPath = "";
}
}
// This function actually reads the file specified and scans it for