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

View File

@ -129,16 +129,18 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
return; return;
} }
bool found = false;
// If the file exists, use it to find dependency information. // If the file exists, use it to find dependency information.
if(cmSystemTools::FileExists(path)) if(cmSystemTools::FileExists(path))
{ {
// Use the real file to find its dependencies. // Use the real file to find its dependencies.
this->DependWalk(info); this->DependWalk(info);
return; found = true;
} }
// The file doesn't exist. See if the cmSourceFile for it has any files // See if the cmSourceFile for it has any files specified as
// specified as dependency hints. // dependency hints.
if(info->m_cmSourceFile != 0) if(info->m_cmSourceFile != 0)
{ {
// Get the cmSourceFile corresponding to this. // Get the cmSourceFile corresponding to this.
@ -147,7 +149,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
// file. // file.
if(!cFile.GetDepends().empty()) 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. // recursion.
for(std::vector<std::string>::const_iterator file = for(std::vector<std::string>::const_iterator file =
cFile.GetDepends().begin(); file != cFile.GetDepends().end(); cFile.GetDepends().begin(); file != cFile.GetDepends().end();
@ -157,21 +159,24 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
} }
// Found dependency information. We are done. // Found dependency information. We are done.
return; found = true;
} }
} }
// Couldn't find any dependency information. if(!found)
if(m_ComplainFileRegularExpression.find(info->m_IncludeName.c_str()))
{ {
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 // This function actually reads the file specified and scans it for