summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-03-07 22:39:16 (GMT)
committerBrad King <brad.king@kitware.com>2007-03-07 22:39:16 (GMT)
commitb90e241a3100e087102d15f06ff43146e93f32f1 (patch)
tree0d65a5618504e605e0f2679e6cfa77c21eabd610 /Source/cmLocalGenerator.cxx
parent4036627487eeaed8058e6cc7290bc591d16c6e79 (diff)
downloadCMake-b90e241a3100e087102d15f06ff43146e93f32f1.zip
CMake-b90e241a3100e087102d15f06ff43146e93f32f1.tar.gz
CMake-b90e241a3100e087102d15f06ff43146e93f32f1.tar.bz2
ENH: Modified GetObjectFileNameWithoutTarget to use relative paths for object file names with sources above the current directory so long as the relative path conversion works.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fed8ea6..789cb11 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2461,21 +2461,20 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(const char* sin)
std::string
cmLocalGenerator::GetObjectFileNameWithoutTarget(const cmSourceFile& source)
{
- // If the source file is located below the current binary directory
- // then use that relative path for the object file name.
+ // Construct the object file name using the full path to the source
+ // file which is its only unique identification. Convert the path
+ // to be relative to the current binary directory if possible.
std::string objectName = this->Convert(source.GetFullPath().c_str(),
START_OUTPUT);
- if(cmSystemTools::FileIsFullPath(objectName.c_str()) ||
- objectName.empty() || objectName[0] == '.')
+ if(cmSystemTools::FileIsFullPath(objectName.c_str()) || objectName.empty())
{
- // If the source file is located below the current source
- // directory then use that relative path for the object file name.
- // Otherwise just use the relative path from the current binary
- // directory.
+ // If the source file can be referenced as a relative path from
+ // the source tree use that relative path to construct the object
+ // name.
std::string relFromSource = this->Convert(source.GetFullPath().c_str(),
START);
if(!cmSystemTools::FileIsFullPath(relFromSource.c_str()) &&
- !relFromSource.empty() && relFromSource[0] != '.')
+ !relFromSource.empty())
{
objectName = relFromSource;
}