Commit 40aa6c05 authored by Brad King's avatar Brad King
Browse files

cmGeneratorTarget: Add method to collect all sources for all configs

Multi-config generators like VS and Xcode need to loop over all the
source files first and then handle per-config information within
each one.  Teach cmGeneratorTarget to provide such a view.
parent e155fba6
......@@ -1069,6 +1069,43 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
std::vector<cmGeneratorTarget::AllConfigSource> const&
cmGeneratorTarget::GetAllConfigSources() const
if (this->AllConfigSources.empty()) {
return this->AllConfigSources;
void cmGeneratorTarget::ComputeAllConfigSources() const
std::vector<std::string> configs;
std::map<cmSourceFile const*, size_t> index;
for (size_t ci = 0; ci < configs.size(); ++ci) {
KindedSources const& sources = this->GetKindedSources(configs[ci]);
for (std::vector<cmGeneratorTarget::SourceAndKind>::const_iterator si =
si != sources.Sources.end(); ++si) {
std::map<cmSourceFile const*, size_t>::iterator mi =
if (mi == index.end()) {
AllConfigSource acs;
acs.Source = si->Source;
acs.Kind = si->Kind;
std::map<cmSourceFile const*, size_t>::value_type entry(
si->Source, this->AllConfigSources.size() - 1);
mi = index.insert(entry).first;
std::string cmGeneratorTarget::GetCompilePDBName(
const std::string& config) const
......@@ -12,6 +12,7 @@
#include <map>
#include <set>
#include <stddef.h>
#include <string>
#include <utility>
#include <vector>
......@@ -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<size_t> Configs;
/** Get all sources needed for all configurations with kinds and
per-source configurations assigned. */
std::vector<AllConfigSource> const& GetAllConfigSources() const;
void GetObjectSources(std::vector<cmSourceFile const*>&,
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<AllConfigSource> AllConfigSources;
void ComputeAllConfigSources() const;
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment