diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5e4259d420..4c8a2c6353 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1069,6 +1069,43 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, } } +std::vector const& +cmGeneratorTarget::GetAllConfigSources() const +{ + if (this->AllConfigSources.empty()) { + this->ComputeAllConfigSources(); + } + return this->AllConfigSources; +} + +void cmGeneratorTarget::ComputeAllConfigSources() const +{ + std::vector configs; + this->Makefile->GetConfigurations(configs); + + std::map index; + + for (size_t ci = 0; ci < configs.size(); ++ci) { + KindedSources const& sources = this->GetKindedSources(configs[ci]); + for (std::vector::const_iterator si = + sources.Sources.begin(); + si != sources.Sources.end(); ++si) { + std::map::iterator mi = + index.find(si->Source); + if (mi == index.end()) { + AllConfigSource acs; + acs.Source = si->Source; + acs.Kind = si->Kind; + this->AllConfigSources.push_back(acs); + std::map::value_type entry( + si->Source, this->AllConfigSources.size() - 1); + mi = index.insert(entry).first; + } + this->AllConfigSources[mi->second].Configs.push_back(ci); + } + } +} + std::string cmGeneratorTarget::GetCompilePDBName( const std::string& config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 7c86d301a4..dd25caddfd 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -107,6 +108,17 @@ public: /** Get all sources needed for a configuration with kinds assigned. */ KindedSources const& GetKindedSources(std::string const& config) const; + struct AllConfigSource + { + cmSourceFile const* Source; + cmGeneratorTarget::SourceKind Kind; + std::vector Configs; + }; + + /** Get all sources needed for all configurations with kinds and + per-source configurations assigned. */ + std::vector const& GetAllConfigSources() const; + void GetObjectSources(std::vector&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); @@ -731,6 +743,9 @@ private: void ComputeKindedSources(KindedSources& files, std::string const& config) const; + mutable std::vector AllConfigSources; + void ComputeAllConfigSources() const; + std::vector IncludeDirectoriesEntries; std::vector CompileOptionsEntries; std::vector CompileFeaturesEntries;