cmSourceFileLocation: Simplify logic in Matches
This commit is contained in:
parent
5554910ec2
commit
e8e1f3a19f
|
@ -211,36 +211,33 @@ cmSourceFileLocation
|
||||||
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
|
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
|
||||||
{
|
{
|
||||||
assert(this->Makefile);
|
assert(this->Makefile);
|
||||||
if(this->AmbiguousExtension && loc.AmbiguousExtension)
|
if(this->AmbiguousExtension == loc.AmbiguousExtension)
|
||||||
{
|
{
|
||||||
// Both extensions are ambiguous. Since only the old fixed set of
|
// Both extensions are similarly ambiguous. Since only the old fixed set
|
||||||
// extensions will be tried, the names must match at this point to
|
// of extensions will be tried, the names must match at this point to be
|
||||||
// be the same file.
|
// the same file.
|
||||||
if(this->Name != loc.Name)
|
if(this->Name != loc.Name)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this->AmbiguousExtension)
|
|
||||||
{
|
|
||||||
// Only "this" extension is ambiguous.
|
|
||||||
if(!loc.MatchesAmbiguousExtension(*this))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(loc.AmbiguousExtension)
|
|
||||||
{
|
|
||||||
// Only "loc" extension is ambiguous.
|
|
||||||
if(!this->MatchesAmbiguousExtension(loc))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Neither extension is ambiguous.
|
const cmSourceFileLocation* loc1;
|
||||||
if(this->Name != loc.Name)
|
const cmSourceFileLocation* loc2;
|
||||||
|
if(this->AmbiguousExtension)
|
||||||
|
{
|
||||||
|
// Only "this" extension is ambiguous.
|
||||||
|
loc1 = &loc;
|
||||||
|
loc2 = this;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Only "loc" extension is ambiguous.
|
||||||
|
loc1 = this;
|
||||||
|
loc2 = &loc;
|
||||||
|
}
|
||||||
|
if(!loc1->MatchesAmbiguousExtension(*loc2))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -254,27 +251,29 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this->AmbiguousDirectory && loc.AmbiguousDirectory &&
|
|
||||||
this->Makefile == loc.Makefile)
|
|
||||||
{
|
|
||||||
// Both sides have directories relative to the same location.
|
|
||||||
if(this->Directory != loc.Directory)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
|
else if(this->AmbiguousDirectory && loc.AmbiguousDirectory)
|
||||||
{
|
{
|
||||||
// Each side has a directory relative to a different location.
|
if (this->Makefile == loc.Makefile)
|
||||||
// This can occur when referencing a source file from a different
|
{
|
||||||
// directory. This is not yet allowed.
|
// Both sides have directories relative to the same location.
|
||||||
this->Makefile->IssueMessage(
|
if(this->Directory != loc.Directory)
|
||||||
cmake::INTERNAL_ERROR,
|
{
|
||||||
"Matches error: Each side has a directory relative to a different "
|
return false;
|
||||||
"location. This can occur when referencing a source file from a "
|
}
|
||||||
"different directory. This is not yet allowed."
|
}
|
||||||
);
|
else
|
||||||
return false;
|
{
|
||||||
|
// Each side has a directory relative to a different location.
|
||||||
|
// This can occur when referencing a source file from a different
|
||||||
|
// directory. This is not yet allowed.
|
||||||
|
this->Makefile->IssueMessage(
|
||||||
|
cmake::INTERNAL_ERROR,
|
||||||
|
"Matches error: Each side has a directory relative to a different "
|
||||||
|
"location. This can occur when referencing a source file from a "
|
||||||
|
"different directory. This is not yet allowed."
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(this->AmbiguousDirectory)
|
else if(this->AmbiguousDirectory)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue