diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8b4ac6f43..26c0e3987 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1089,7 +1089,6 @@ private: cmGlobalGenerator* GlobalGenerator; std::queue DependencyQueue; std::set DependenciesQueued; - std::set TargetSources; void QueueOnce(std::string const& name); void QueueOnce(std::vector const& names); @@ -1120,9 +1119,6 @@ cmTargetTraceDependencies // Queue the dependencies of the source file in case they are // generated. this->QueueDependencies(*si); - - // Track the sources already known to the target. - this->TargetSources.insert(*si); } // Queue the VS project file to check dependencies on the rule to @@ -1156,10 +1152,7 @@ void cmTargetTraceDependencies::Trace() this->QueueDependencies(sf); // Make sure this file is in the target. - if(this->TargetSources.insert(sf).second) - { - this->Target->AddSourceFile(sf); - } + this->Target->AddSourceFile(sf); } } } @@ -1330,6 +1323,21 @@ bool cmTarget::FindSourceFiles() return true; } +//---------------------------------------------------------------------------- +std::vector 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 const& srcs) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 7b8c2ba80..5054f2d82 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -119,9 +119,8 @@ public: /** * Get the list of the source files used by this target */ - std::vector const &GetSourceFiles() - {return this->SourceFiles;} - void AddSourceFile(cmSourceFile* sf) { this->SourceFiles.push_back(sf); } + std::vector const& GetSourceFiles(); + void AddSourceFile(cmSourceFile* sf); /** * Flags for a given source file as used in this target. Typically assigned @@ -531,6 +530,7 @@ private: std::vector PostBuildCommands; TargetType TargetTypeValue; std::vector SourceFiles; + std::set SourceFileSet; LinkLibraryVectorType LinkLibraries; LinkLibraryVectorType PrevLinkedLibraries; bool LinkLibrariesAnalyzed;