[Cmake-commits] [cmake-commits] alex committed cmGlobalUnixMakefileGenerator3.cxx 1.137 1.138 cmLocalUnixMakefileGenerator3.cxx 1.269 1.270

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Sep 22 14:40:25 EDT 2009


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

Modified Files:
	cmGlobalUnixMakefileGenerator3.cxx 
	cmLocalUnixMakefileGenerator3.cxx 
Log Message:
Rescan dependencies also if CMakeDirectoryInformation.cmake has changed.

If CMakeDirectoryInformation.cmake is newer than depend.internal the include
directories may have changed, so dependencies need to be scanned again. 
Ok by Brad.

Alex


Index: cmGlobalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalUnixMakefileGenerator3.cxx,v
retrieving revision 1.137
retrieving revision 1.138
diff -C 2 -d -r1.137 -r1.138
*** cmGlobalUnixMakefileGenerator3.cxx	8 Jul 2009 17:03:46 -0000	1.137
--- cmGlobalUnixMakefileGenerator3.cxx	22 Sep 2009 18:40:23 -0000	1.138
***************
*** 353,370 ****
      << lg->Convert(check.c_str(),
                     cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
- 
-   // add in all the directory information files
-   std::string tmpStr;
-   for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
-     {
-     lg = 
-       static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
-     tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
-     tmpStr += cmake::GetCMakeFilesDirectory();
-     tmpStr += "/CMakeDirectoryInformation.cmake";
-     cmakefileStream << "  \"" << 
-       lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() 
-                     << "\"\n";
-     }
    cmakefileStream << "  )\n\n";
  
--- 353,356 ----
***************
*** 383,386 ****
--- 369,386 ----
                      << "\"\n";
      }
+ 
+   // add in all the directory information files
+   std::string tmpStr;
+   for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
+     {
+     lg = 
+       static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
+     tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
+     tmpStr += cmake::GetCMakeFilesDirectory();
+     tmpStr += "/CMakeDirectoryInformation.cmake";
+     cmakefileStream << "  \"" << 
+       lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() 
+                     << "\"\n";
+     }
    cmakefileStream << "  )\n\n";
    }

Index: cmLocalUnixMakefileGenerator3.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v
retrieving revision 1.269
retrieving revision 1.270
diff -C 2 -d -r1.269 -r1.270
*** cmLocalUnixMakefileGenerator3.cxx	16 Sep 2009 22:01:23 -0000	1.269
--- cmLocalUnixMakefileGenerator3.cxx	22 Sep 2009 18:40:23 -0000	1.270
***************
*** 437,440 ****
--- 437,441 ----
      }
  
+   infoFileStream.SetCopyIfDifferent(true);
    // Write the do not edit header.
    this->WriteDisclaimer(infoFileStream);
***************
*** 1353,1357 ****
    // happen when a new source file is added and CMake regenerates the
    // project but no other sources were touched.
!   bool needRescan = false;
    cmFileTimeComparison* ftc =
      this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
--- 1354,1358 ----
    // happen when a new source file is added and CMake regenerates the
    // project but no other sources were touched.
!   bool needRescanDependInfo = false;
    cmFileTimeComparison* ftc =
      this->GlobalGenerator->GetCMakeInstance()->GetFileComparison();
***************
*** 1369,1385 ****
        cmSystemTools::Stdout(msg.str().c_str());
        }
!     needRescan = true;
      }
    }
  
    // Check the implicit dependencies to see if they are up to date.
    // The build.make file may have explicit dependencies for the object
    // files but these will not affect the scanning process so they need
    // not be considered.
!   cmDependsC checker;
!   checker.SetVerbose(verbose);
!   checker.SetFileComparison(ftc);
!   if(needRescan ||
!      !checker.Check(dependFile.c_str(), internalDependFile.c_str()))
      {
      // The dependencies must be regenerated.
--- 1370,1415 ----
        cmSystemTools::Stdout(msg.str().c_str());
        }
!     needRescanDependInfo = true;
      }
    }
  
+   // If the directory information is newer than depend.internal, include dirs
+   // may have changed. In this case discard all old dependencies.
+   bool needRescanDirInfo = false;
+   std::string dirInfoFile = this->Makefile->GetStartOutputDirectory();
+   dirInfoFile += cmake::GetCMakeFilesDirectory();
+   dirInfoFile += "/CMakeDirectoryInformation.cmake";
+   {
+   int result;
+   if(!ftc->FileTimeCompare(internalDependFile.c_str(), 
+                            dirInfoFile.c_str(), &result) || result < 0)
+     {
+     if(verbose)
+       {
+       cmOStringStream msg;
+       msg << "Dependee \"" << internalDependFile
+           << "\" is newer than depender \""
+           << dirInfoFile << "\"." << std::endl;
+       cmSystemTools::Stdout(msg.str().c_str());
+       }
+     needRescanDirInfo = true;
+     }
+   }
+   
    // Check the implicit dependencies to see if they are up to date.
    // The build.make file may have explicit dependencies for the object
    // files but these will not affect the scanning process so they need
    // not be considered.
!   bool needRescanDependencies = false;
!   if (needRescanDirInfo == false)
!     {
!     cmDependsC checker;
!     checker.SetVerbose(verbose);
!     checker.SetFileComparison(ftc);
!     needRescanDependencies = !checker.Check(dependFile.c_str(),
!                                             internalDependFile.c_str());
!     }
! 
!   if(needRescanDependInfo || needRescanDirInfo || needRescanDependencies)
      {
      // The dependencies must be regenerated.



More information about the Cmake-commits mailing list