[Cmake-commits] [cmake-commits] king committed cmGlobalGenerator.cxx 1.252 1.253 cmGlobalGenerator.h 1.120 1.121

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 9 12:19:29 EDT 2009


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

Modified Files:
	cmGlobalGenerator.cxx cmGlobalGenerator.h 
Log Message:
ENH: Generate a central list of target directories

This generalizes the previous CMakeFiles/LabelFiles.txt created at the
top of the build tree to a CMakeFiles/TargetDirectories.txt file.  It
lists the target support directories for all targets in the project.
Labels can still be loaded by looking for Labels.txt files in each
target directory.


Index: cmGlobalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -C 2 -d -r1.120 -r1.121
*** cmGlobalGenerator.h	4 Mar 2009 20:38:47 -0000	1.120
--- cmGlobalGenerator.h	9 Mar 2009 16:19:27 -0000	1.121
***************
*** 337,342 ****
    void CheckRuleHashes();
  
!   void WriteTargetLabels();
!   bool WriteTargetLabels(cmTarget* target, std::string& file);
  
    cmExternalMakefileProjectGenerator* ExtraGenerator;
--- 337,342 ----
    void CheckRuleHashes();
  
!   void WriteSummary();
!   void WriteSummary(cmTarget* target);
  
    cmExternalMakefileProjectGenerator* ExtraGenerator;

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.252
retrieving revision 1.253
diff -C 2 -d -r1.252 -r1.253
*** cmGlobalGenerator.cxx	4 Mar 2009 20:38:46 -0000	1.252
--- cmGlobalGenerator.cxx	9 Mar 2009 16:19:27 -0000	1.253
***************
*** 902,906 ****
    this->CheckRuleHashes();
  
!   this->WriteTargetLabels();
  
    if (this->ExtraGenerator != 0)
--- 902,906 ----
    this->CheckRuleHashes();
  
!   this->WriteSummary();
  
    if (this->ExtraGenerator != 0)
***************
*** 2138,2179 ****
  
  //----------------------------------------------------------------------------
! void cmGlobalGenerator::WriteTargetLabels()
  {
    cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
  
!   // Record generated per-target label files in a central location.
    std::string fname = mf->GetHomeOutputDirectory();
    fname += cmake::GetCMakeFilesDirectory();
!   fname += "/LabelFiles.txt";
!   bool opened = false;
!   cmGeneratedFileStream fout;
  
!   // Generate a label file for each target.
!   std::string file;
    for(std::map<cmStdString,cmTarget *>::const_iterator ti =
          this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
      {
!     if(this->WriteTargetLabels(ti->second, file))
!       {
!       if(!opened)
!         {
!         fout.Open(fname.c_str());
!         opened = true;
!         }
!       fout << file << "\n";
!       }
!     }
!   if(!opened)
!     {
!     cmSystemTools::RemoveFile(fname.c_str());
      }
  }
  
  //----------------------------------------------------------------------------
! bool cmGlobalGenerator::WriteTargetLabels(cmTarget* target, std::string& file)
  {
    // Place the labels file in a per-target support directory.
    std::string dir = target->GetSupportDirectory();
!   file = dir;
    file += "/Labels.txt";
  
--- 2138,2167 ----
  
  //----------------------------------------------------------------------------
! void cmGlobalGenerator::WriteSummary()
  {
    cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
  
!   // Record all target directories in a central location.
    std::string fname = mf->GetHomeOutputDirectory();
    fname += cmake::GetCMakeFilesDirectory();
!   fname += "/TargetDirectories.txt";
!   cmGeneratedFileStream fout(fname.c_str());
  
!   // Generate summary information files for each target.
!   std::string dir;
    for(std::map<cmStdString,cmTarget *>::const_iterator ti =
          this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti)
      {
!     this->WriteSummary(ti->second);
!     fout << ti->second->GetSupportDirectory() << "\n";
      }
  }
  
  //----------------------------------------------------------------------------
! void cmGlobalGenerator::WriteSummary(cmTarget* target)
  {
    // Place the labels file in a per-target support directory.
    std::string dir = target->GetSupportDirectory();
!   std::string file = dir;
    file += "/Labels.txt";
  
***************
*** 2217,2226 ****
          }
        }
-     return true;
      }
    else
      {
      cmSystemTools::RemoveFile(file.c_str());
-     return false;
      }
  }
--- 2205,2212 ----



More information about the Cmake-commits mailing list