BUG: fix for bug 1850 wrapping can leave out files if they are a substring of another file

This commit is contained in:
Bill Hoffman 2005-07-14 15:12:02 -04:00
parent 0d14b57605
commit a9692f0a18
1 changed files with 5 additions and 2 deletions

View File

@ -1157,8 +1157,11 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
{
// is the output of the custom command match the source files name
out = (*i)->GetCustomCommand()->GetOutput();
if (out.rfind(name) != out.npos &&
out.rfind(name) == out.size() - name.size())
std::string::size_type pos = out.rfind(name);
// If the output matches exactly
if (pos != out.npos &&
pos == out.size() - name.size() &&
(pos ==0 || out[pos-1] == '/'))
{
return *i;
}