BUG: Fixed object file name construction to use Convert method for relative path conversion. Also fixed test of result to check explicitly for a full path.

This commit is contained in:
Brad King 2006-03-14 11:35:37 -05:00
parent c332ff41f1
commit 8e702ac5a8

View File

@ -1509,19 +1509,19 @@ cmLocalUnixMakefileGenerator3
{ {
// If the source file is located below the current binary directory // If the source file is located below the current binary directory
// then use that relative path for the object file name. // then use that relative path for the object file name.
std::string objectName = std::string objectName = this->Convert(source.GetFullPath().c_str(),
cmSystemTools::RelativePath(m_Makefile->GetCurrentOutputDirectory(), START_OUTPUT);
source.GetFullPath().c_str()); if(cmSystemTools::FileIsFullPath(objectName.c_str()) ||
if(objectName.empty() || objectName[0] == '.') objectName.empty() || objectName[0] == '.')
{ {
// If the source file is located below the current source // If the source file is located below the current source
// directory then use that relative path for the object file name. // directory then use that relative path for the object file name.
// Otherwise just use the relative path from the current binary // Otherwise just use the relative path from the current binary
// directory. // directory.
std::string relFromSource = std::string relFromSource = this->Convert(source.GetFullPath().c_str(),
cmSystemTools::RelativePath(m_Makefile->GetCurrentDirectory(), START);
source.GetFullPath().c_str()); if(!cmSystemTools::FileIsFullPath(relFromSource.c_str()) &&
if(!relFromSource.empty() && relFromSource[0] != '.') !relFromSource.empty() && relFromSource[0] != '.')
{ {
objectName = relFromSource; objectName = relFromSource;
} }