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

View File

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