[cmake-commits] king committed cmLocalGenerator.cxx 1.194 1.195

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Mar 7 17:39:18 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv21831

Modified Files:
	cmLocalGenerator.cxx 
Log Message:
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.


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- cmLocalGenerator.cxx	7 Mar 2007 22:32:35 -0000	1.194
+++ cmLocalGenerator.cxx	7 Mar 2007 22:39:16 -0000	1.195
@@ -2461,21 +2461,20 @@
 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;
       }



More information about the Cmake-commits mailing list