[Cmake-commits] [cmake-commits] king committed cmTarget.cxx 1.268 1.269 cmTarget.h 1.140 1.141

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Sep 4 12:39:07 EDT 2009


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

Modified Files:
	cmTarget.cxx cmTarget.h 
Log Message:
Cleanup cmTarget source file list representation

This teaches cmTarget to use a set of cmSourceFile pointers to guarantee
unique insertion of source files in a target.  The order of insertion is
still preserved in the SourceFiles vector.


Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.140
retrieving revision 1.141
diff -C 2 -d -r1.140 -r1.141
*** cmTarget.h	1 Sep 2009 14:37:37 -0000	1.140
--- cmTarget.h	4 Sep 2009 16:39:05 -0000	1.141
***************
*** 120,126 ****
     * Get the list of the source files used by this target
     */
!   std::vector<cmSourceFile*> const &GetSourceFiles()
!     {return this->SourceFiles;}
!   void AddSourceFile(cmSourceFile* sf) { this->SourceFiles.push_back(sf); }
  
    /**
--- 120,125 ----
     * Get the list of the source files used by this target
     */
!   std::vector<cmSourceFile*> const& GetSourceFiles();
!   void AddSourceFile(cmSourceFile* sf);
  
    /**
***************
*** 532,535 ****
--- 531,535 ----
    TargetType TargetTypeValue;
    std::vector<cmSourceFile*> SourceFiles;
+   std::set<cmSourceFile*> SourceFileSet;
    LinkLibraryVectorType LinkLibraries;
    LinkLibraryVectorType PrevLinkedLibraries;

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.268
retrieving revision 1.269
diff -C 2 -d -r1.268 -r1.269
*** cmTarget.cxx	1 Sep 2009 14:37:36 -0000	1.268
--- cmTarget.cxx	4 Sep 2009 16:39:05 -0000	1.269
***************
*** 1090,1094 ****
    std::queue<cmStdString> DependencyQueue;
    std::set<cmStdString> DependenciesQueued;
-   std::set<cmSourceFile*> TargetSources;
  
    void QueueOnce(std::string const& name);
--- 1090,1093 ----
***************
*** 1121,1127 ****
      // generated.
      this->QueueDependencies(*si);
- 
-     // Track the sources already known to the target.
-     this->TargetSources.insert(*si);
      }
  
--- 1120,1123 ----
***************
*** 1157,1164 ****
  
        // Make sure this file is in the target.
!       if(this->TargetSources.insert(sf).second)
!         {
!         this->Target->AddSourceFile(sf);
!         }
        }
      }
--- 1153,1157 ----
  
        // Make sure this file is in the target.
!       this->Target->AddSourceFile(sf);
        }
      }
***************
*** 1332,1335 ****
--- 1325,1343 ----
  
  //----------------------------------------------------------------------------
+ std::vector<cmSourceFile*> const& cmTarget::GetSourceFiles()
+ {
+   return this->SourceFiles;
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmTarget::AddSourceFile(cmSourceFile* sf)
+ {
+   if(this->SourceFileSet.insert(sf).second)
+     {
+     this->SourceFiles.push_back(sf);
+     }
+ }
+ 
+ //----------------------------------------------------------------------------
  void cmTarget::AddSources(std::vector<std::string> const& srcs)
  {



More information about the Cmake-commits mailing list