cmGeneratorTarget: Add methods to access source file groups.

These methods and others will be able to get a config parameter
later to implement the INTERFACE_SOURCES feature.
This commit is contained in:
Stephen Kelly 2013-11-10 11:22:44 +01:00
parent f579fe0d7a
commit 38de54cf6f
11 changed files with 209 additions and 77 deletions

View File

@ -102,6 +102,84 @@ static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name,
} }
} }
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetObjectSources(std::vector<cmSourceFile*> &objs) const
{
objs = this->ObjectSources;
}
//----------------------------------------------------------------------------
const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
{
return this->Objects[file];
}
void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name)
{
this->Objects[sf] = name;
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf)
{
this->ExplicitObjectName.insert(sf);
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
{
std::set<cmSourceFile const*>::const_iterator it
= this->ExplicitObjectName.find(file);
return it != this->ExplicitObjectName.end();
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->ResxSources;
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetIDLSources(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->IDLSources;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetHeaderSources(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->HeaderSources;
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetExtraSources(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->ExtraSources;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetCustomCommands(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->CustomCommands;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetExpectedResxHeaders(std::set<std::string>& srcs) const
{
srcs = this->ExpectedResxHeaders;
}
//----------------------------------------------------------------------------
void
cmGeneratorTarget::GetExternalObjects(std::vector<cmSourceFile*>& srcs) const
{
srcs = this->ExternalObjects;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
const char *config) const const char *config) const

View File

@ -32,34 +32,33 @@ public:
bool GetPropertyAsBool(const char *prop) const; bool GetPropertyAsBool(const char *prop) const;
std::vector<cmSourceFile*> const& GetSourceFiles() const; std::vector<cmSourceFile*> const& GetSourceFiles() const;
void GetObjectSources(std::vector<cmSourceFile*> &) const;
const std::string& GetObjectName(cmSourceFile const* file);
void AddObject(cmSourceFile *sf, std::string const&name);
bool HasExplicitObjectName(cmSourceFile const* file) const;
void AddExplicitObjectName(cmSourceFile* sf);
void GetResxSources(std::vector<cmSourceFile*>&) const;
void GetIDLSources(std::vector<cmSourceFile*>&) const;
void GetExternalObjects(std::vector<cmSourceFile*>&) const;
void GetHeaderSources(std::vector<cmSourceFile*>&) const;
void GetExtraSources(std::vector<cmSourceFile*>&) const;
void GetCustomCommands(std::vector<cmSourceFile*>&) const;
void GetExpectedResxHeaders(std::set<std::string>&) const;
cmTarget* Target; cmTarget* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator; cmLocalGenerator* LocalGenerator;
cmGlobalGenerator* GlobalGenerator; cmGlobalGenerator* GlobalGenerator;
/** Sources classified by purpose. */
std::vector<cmSourceFile*> CustomCommands;
std::vector<cmSourceFile*> ExtraSources;
std::vector<cmSourceFile*> HeaderSources;
std::vector<cmSourceFile*> ObjectSources;
std::vector<cmSourceFile*> ExternalObjects;
std::vector<cmSourceFile*> IDLSources;
std::vector<cmSourceFile*> ResxSources;
std::string ModuleDefinitionFile; std::string ModuleDefinitionFile;
std::map<cmSourceFile const*, std::string> Objects;
std::set<cmSourceFile const*> ExplicitObjectName;
std::set<std::string> ExpectedResxHeaders;
/** Full path with trailing slash to the top-level directory /** Full path with trailing slash to the top-level directory
holding object files for this target. Includes the build holding object files for this target. Includes the build
time config name placeholder if needed for the generator. */ time config name placeholder if needed for the generator. */
std::string ObjectDirectory; std::string ObjectDirectory;
std::vector<cmTarget*> ObjectLibraries;
void UseObjectLibraries(std::vector<std::string>& objs) const; void UseObjectLibraries(std::vector<std::string>& objs) const;
void GetAppleArchs(const char* config, void GetAppleArchs(const char* config,
@ -89,11 +88,23 @@ public:
/** Get sources that must be built before the given source. */ /** Get sources that must be built before the given source. */
std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const; std::vector<cmSourceFile*> const* GetSourceDepends(cmSourceFile* sf) const;
private:
friend class cmTargetTraceDependencies;
struct SourceEntry { std::vector<cmSourceFile*> Depends; }; struct SourceEntry { std::vector<cmSourceFile*> Depends; };
typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType; typedef std::map<cmSourceFile*, SourceEntry> SourceEntriesType;
SourceEntriesType SourceEntries; SourceEntriesType SourceEntries;
private: std::vector<cmSourceFile*> CustomCommands;
std::vector<cmSourceFile*> ExtraSources;
std::vector<cmSourceFile*> HeaderSources;
std::vector<cmSourceFile*> ExternalObjects;
std::vector<cmSourceFile*> IDLSources;
std::vector<cmSourceFile*> ResxSources;
std::map<cmSourceFile const*, std::string> Objects;
std::set<cmSourceFile const*> ExplicitObjectName;
std::set<std::string> ExpectedResxHeaders;
std::vector<cmSourceFile*> ObjectSources;
std::vector<cmTarget*> ObjectLibraries;
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache; mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
cmGeneratorTarget(cmGeneratorTarget const&); cmGeneratorTarget(cmGeneratorTarget const&);

View File

@ -644,15 +644,17 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
dir_max += "/"; dir_max += "/";
gt->ObjectDirectory = dir_max; gt->ObjectDirectory = dir_max;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
// Compute the name of each object file. // Compute the name of each object file.
for(std::vector<cmSourceFile*>::iterator for(std::vector<cmSourceFile*>::iterator
si = gt->ObjectSources.begin(); si = objectSources.begin();
si != gt->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
cmSourceFile* sf = *si; cmSourceFile* sf = *si;
std::string objectName = gt->LocalGenerator std::string objectName = gt->LocalGenerator
->GetObjectFileNameWithoutTarget(*sf, dir_max); ->GetObjectFileNameWithoutTarget(*sf, dir_max);
gt->Objects[sf] = objectName; gt->AddObject(sf, objectName);
} }
} }

View File

@ -120,17 +120,19 @@ cmGlobalUnixMakefileGenerator3
dir_max += "/"; dir_max += "/";
gt->ObjectDirectory = dir_max; gt->ObjectDirectory = dir_max;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
// Compute the name of each object file. // Compute the name of each object file.
for(std::vector<cmSourceFile*>::iterator for(std::vector<cmSourceFile*>::iterator
si = gt->ObjectSources.begin(); si = objectSources.begin();
si != gt->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
cmSourceFile* sf = *si; cmSourceFile* sf = *si;
bool hasSourceExtension = true; bool hasSourceExtension = true;
std::string objectName = gt->LocalGenerator std::string objectName = gt->LocalGenerator
->GetObjectFileNameWithoutTarget(*sf, dir_max, ->GetObjectFileNameWithoutTarget(*sf, dir_max,
&hasSourceExtension); &hasSourceExtension);
gt->Objects[sf] = objectName; gt->AddObject(sf, objectName);
lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension);
} }
} }

View File

@ -129,9 +129,11 @@ cmGlobalVisualStudioGenerator
// Count the number of object files with each name. Note that // Count the number of object files with each name. Note that
// windows file names are not case sensitive. // windows file names are not case sensitive.
std::map<cmStdString, int> counts; std::map<cmStdString, int> counts;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = gt->ObjectSources.begin(); si = objectSources.begin();
si != gt->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
cmSourceFile* sf = *si; cmSourceFile* sf = *si;
std::string objectNameLower = cmSystemTools::LowerCase( std::string objectNameLower = cmSystemTools::LowerCase(
@ -143,8 +145,8 @@ cmGlobalVisualStudioGenerator
// For all source files producing duplicate names we need unique // For all source files producing duplicate names we need unique
// object name computation. // object name computation.
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = gt->ObjectSources.begin(); si = objectSources.begin();
si != gt->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
cmSourceFile* sf = *si; cmSourceFile* sf = *si;
std::string objectName = std::string objectName =
@ -152,10 +154,10 @@ cmGlobalVisualStudioGenerator
objectName += ".obj"; objectName += ".obj";
if(counts[cmSystemTools::LowerCase(objectName)] > 1) if(counts[cmSystemTools::LowerCase(objectName)] > 1)
{ {
gt->ExplicitObjectName.insert(sf); gt->AddExplicitObjectName(sf);
objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max);
} }
gt->Objects[sf] = objectName; gt->AddObject(sf, objectName);
} }
std::string dir = gt->Makefile->GetCurrentOutputDirectory(); std::string dir = gt->Makefile->GetCurrentOutputDirectory();

View File

@ -3925,9 +3925,11 @@ cmGlobalXCodeGenerator
// to avoid exact duplicate file names. Note that Mac file names are not // to avoid exact duplicate file names. Note that Mac file names are not
// typically case sensitive, hence the LowerCase. // typically case sensitive, hence the LowerCase.
std::map<cmStdString, int> counts; std::map<cmStdString, int> counts;
std::vector<cmSourceFile*> objectSources;
gt->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = gt->ObjectSources.begin(); si = objectSources.begin();
si != gt->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
cmSourceFile* sf = *si; cmSourceFile* sf = *si;
std::string objectName = std::string objectName =
@ -3941,7 +3943,7 @@ cmGlobalXCodeGenerator
// TODO: emit warning about duplicate name? // TODO: emit warning about duplicate name?
} }
gt->Objects[sf] = objectName; gt->AddObject(sf, objectName);
} }
const char* configName = this->GetCMakeCFGIntDir(); const char* configName = this->GetCMakeCFGIntDir();

View File

@ -401,9 +401,9 @@ void cmLocalVisualStudio6Generator
std::string compileFlags; std::string compileFlags;
std::vector<std::string> depends; std::vector<std::string> depends;
std::string objectNameDir; std::string objectNameDir;
if(gt->ExplicitObjectName.find(*sf) != gt->ExplicitObjectName.end()) if(gt->HasExplicitObjectName(*sf))
{ {
objectNameDir = cmSystemTools::GetFilenamePath(gt->Objects[*sf]); objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf));
} }
// Add per-source file flags. // Add per-source file flags.

View File

@ -1468,9 +1468,9 @@ cmLocalVisualStudio7GeneratorFCInfo
cmGeneratorTarget* gt = cmGeneratorTarget* gt =
lg->GetGlobalGenerator()->GetGeneratorTarget(&target); lg->GetGlobalGenerator()->GetGeneratorTarget(&target);
std::string objectName; std::string objectName;
if(gt->ExplicitObjectName.find(&sf) != gt->ExplicitObjectName.end()) if(gt->HasExplicitObjectName(&sf))
{ {
objectName = gt->Objects[&sf]; objectName = gt->GetObjectName(&sf);
} }
// Compute per-source, per-config information. // Compute per-source, per-config information.

View File

@ -151,9 +151,11 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
// First generate the object rule files. Save a list of all object // First generate the object rule files. Save a list of all object
// files for this target. // files for this target.
std::vector<cmSourceFile*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->CustomCommands.begin(); si = customCommands.begin();
si != this->GeneratorTarget->CustomCommands.end(); ++si) si != customCommands.end(); ++si)
{ {
cmCustomCommand const* cc = (*si)->GetCustomCommand(); cmCustomCommand const* cc = (*si)->GetCustomCommand();
this->GenerateCustomRuleFile(*cc); this->GenerateCustomRuleFile(*cc);
@ -170,21 +172,28 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
} }
} }
} }
std::vector<cmSourceFile*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources);
this->OSXBundleGenerator->GenerateMacOSXContentStatements( this->OSXBundleGenerator->GenerateMacOSXContentStatements(
this->GeneratorTarget->HeaderSources, headerSources,
this->MacOSXContentGenerator); this->MacOSXContentGenerator);
std::vector<cmSourceFile*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources);
this->OSXBundleGenerator->GenerateMacOSXContentStatements( this->OSXBundleGenerator->GenerateMacOSXContentStatements(
this->GeneratorTarget->ExtraSources, extraSources,
this->MacOSXContentGenerator); this->MacOSXContentGenerator);
std::vector<cmSourceFile*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ExternalObjects.begin(); si = externalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si) si != externalObjects.end(); ++si)
{ {
this->ExternalObjects.push_back((*si)->GetFullPath()); this->ExternalObjects.push_back((*si)->GetFullPath());
} }
std::vector<cmSourceFile*> objectSources;
this->GeneratorTarget->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ObjectSources.begin(); si = objectSources.begin(); si != objectSources.end(); ++si)
si != this->GeneratorTarget->ObjectSources.end(); ++si)
{ {
// Generate this object file's rule file. // Generate this object file's rule file.
this->WriteObjectRuleFiles(**si); this->WriteObjectRuleFiles(**si);
@ -421,7 +430,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
} }
// Get the full path name of the object file. // Get the full path name of the object file.
std::string const& objectName = this->GeneratorTarget->Objects[&source]; std::string const& objectName = this->GeneratorTarget
->GetObjectName(&source);
std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target); std::string obj = this->LocalGenerator->GetTargetDirectory(*this->Target);
obj += "/"; obj += "/";
obj += objectName; obj += objectName;

View File

@ -276,7 +276,8 @@ cmNinjaTargetGenerator
std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); std::string path = this->LocalGenerator->GetHomeRelativeOutputPath();
if(!path.empty()) if(!path.empty())
path += "/"; path += "/";
std::string const& objectName = this->GeneratorTarget->Objects[source]; std::string const& objectName = this->GeneratorTarget
->GetObjectName(source);
path += this->LocalGenerator->GetTargetDirectory(*this->Target); path += this->LocalGenerator->GetTargetDirectory(*this->Target);
path += "/"; path += "/";
path += objectName; path += objectName;
@ -458,28 +459,37 @@ cmNinjaTargetGenerator
<< this->GetTargetName() << this->GetTargetName()
<< "\n\n"; << "\n\n";
std::vector<cmSourceFile*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->CustomCommands.begin(); si = customCommands.begin();
si != this->GeneratorTarget->CustomCommands.end(); ++si) si != customCommands.end(); ++si)
{ {
cmCustomCommand const* cc = (*si)->GetCustomCommand(); cmCustomCommand const* cc = (*si)->GetCustomCommand();
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
} }
std::vector<cmSourceFile*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources);
this->OSXBundleGenerator->GenerateMacOSXContentStatements( this->OSXBundleGenerator->GenerateMacOSXContentStatements(
this->GeneratorTarget->HeaderSources, headerSources,
this->MacOSXContentGenerator); this->MacOSXContentGenerator);
std::vector<cmSourceFile*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources);
this->OSXBundleGenerator->GenerateMacOSXContentStatements( this->OSXBundleGenerator->GenerateMacOSXContentStatements(
this->GeneratorTarget->ExtraSources, extraSources,
this->MacOSXContentGenerator); this->MacOSXContentGenerator);
std::vector<cmSourceFile*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ExternalObjects.begin(); si = externalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si) si != externalObjects.end(); ++si)
{ {
this->Objects.push_back(this->GetSourceFilePath(*si)); this->Objects.push_back(this->GetSourceFilePath(*si));
} }
std::vector<cmSourceFile*> objectSources;
this->GeneratorTarget->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ObjectSources.begin(); si = objectSources.begin(); si != objectSources.end(); ++si)
si != this->GeneratorTarget->ObjectSources.end(); ++si)
{ {
this->WriteObjectBuildStatement(*si); this->WriteObjectBuildStatement(*si);
} }
@ -539,9 +549,11 @@ cmNinjaTargetGenerator
} }
// Add order-only dependencies on custom command outputs. // Add order-only dependencies on custom command outputs.
std::vector<cmSourceFile*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->CustomCommands.begin(); si = customCommands.begin();
si != this->GeneratorTarget->CustomCommands.end(); ++si) si != customCommands.end(); ++si)
{ {
cmCustomCommand const* cc = (*si)->GetCustomCommand(); cmCustomCommand const* cc = (*si)->GetCustomCommand();
const std::vector<std::string>& ccoutputs = cc->GetOutputs(); const std::vector<std::string>& ccoutputs = cc->GetOutputs();

View File

@ -376,8 +376,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
{ {
std::vector<cmSourceFile*> const& resxObjs = std::vector<cmSourceFile*> resxObjs;
this->GeneratorTarget->ResxSources; this->GeneratorTarget->GetResxSources(resxObjs);
if(!resxObjs.empty()) if(!resxObjs.empty())
{ {
this->WriteString("<ItemGroup>\n", 1); this->WriteString("<ItemGroup>\n", 1);
@ -550,9 +550,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
void cmVisualStudio10TargetGenerator::WriteCustomCommands() void cmVisualStudio10TargetGenerator::WriteCustomCommands()
{ {
this->SourcesVisited.clear(); this->SourcesVisited.clear();
std::vector<cmSourceFile*> customCommands;
this->GeneratorTarget->GetCustomCommands(customCommands);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->CustomCommands.begin(); si = customCommands.begin();
si != this->GeneratorTarget->CustomCommands.end(); ++si) si != customCommands.end(); ++si)
{ {
this->WriteCustomCommand(*si); this->WriteCustomCommand(*si);
} }
@ -740,8 +742,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups); this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
} }
std::vector<cmSourceFile*> const& resxObjs = std::vector<cmSourceFile*> resxObjs;
this->GeneratorTarget->ResxSources; this->GeneratorTarget->GetResxSources(resxObjs);
if(!resxObjs.empty()) if(!resxObjs.empty())
{ {
this->WriteString("<ItemGroup>\n", 1); this->WriteString("<ItemGroup>\n", 1);
@ -813,7 +815,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->WriteString("</Filter>\n", 2); this->WriteString("</Filter>\n", 2);
} }
if(!this->GeneratorTarget->ResxSources.empty()) if(!resxObjs.empty())
{ {
this->WriteString("<Filter Include=\"Resource Files\">\n", 2); this->WriteString("<Filter Include=\"Resource Files\">\n", 2);
std::string guidName = "SG_Filter_Resource Files"; std::string guidName = "SG_Filter_Resource Files";
@ -996,12 +998,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
} }
this->WriteString("<ItemGroup>\n", 1); this->WriteString("<ItemGroup>\n", 1);
this->WriteSources("ClInclude", this->GeneratorTarget->HeaderSources); std::vector<cmSourceFile*> headerSources;
this->WriteSources("Midl", this->GeneratorTarget->IDLSources); this->GeneratorTarget->GetHeaderSources(headerSources);
this->WriteSources("ClInclude", headerSources);
std::vector<cmSourceFile*> idlSources;
this->GeneratorTarget->GetIDLSources(idlSources);
this->WriteSources("Midl", idlSources);
std::vector<cmSourceFile*> objectSources;
this->GeneratorTarget->GetObjectSources(objectSources);
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ObjectSources.begin(); si = objectSources.begin();
si != this->GeneratorTarget->ObjectSources.end(); ++si) si != objectSources.end(); ++si)
{ {
const char* lang = (*si)->GetLanguage(); const char* lang = (*si)->GetLanguage();
const char* tool = NULL; const char* tool = NULL;
@ -1038,19 +1046,21 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
} }
} }
std::vector<cmSourceFile*> externalObjects;
this->GeneratorTarget->GetExternalObjects(externalObjects);
if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
{ {
// For VS >= 11 we use LinkObjects to avoid linking custom command // For VS >= 11 we use LinkObjects to avoid linking custom command
// outputs. Use Object for all external objects, generated or not. // outputs. Use Object for all external objects, generated or not.
this->WriteSources("Object", this->GeneratorTarget->ExternalObjects); this->WriteSources("Object", externalObjects);
} }
else else
{ {
// If an object file is generated in this target, then vs10 will use // If an object file is generated in this target, then vs10 will use
// it in the build, and we have to list it as None instead of Object. // it in the build, and we have to list it as None instead of Object.
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
si = this->GeneratorTarget->ExternalObjects.begin(); si = externalObjects.begin();
si != this->GeneratorTarget->ExternalObjects.end(); ++si) si != externalObjects.end(); ++si)
{ {
std::vector<cmSourceFile*> const* d = std::vector<cmSourceFile*> const* d =
this->GeneratorTarget->GetSourceDepends(*si); this->GeneratorTarget->GetSourceDepends(*si);
@ -1058,7 +1068,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
} }
} }
this->WriteSources("None", this->GeneratorTarget->ExtraSources); std::vector<cmSourceFile*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources);
this->WriteSources("None", extraSources);
// Add object library contents as external objects. // Add object library contents as external objects.
std::vector<std::string> objs; std::vector<std::string> objs;
@ -1081,10 +1093,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmSourceFile& sf = *source; cmSourceFile& sf = *source;
std::string objectName; std::string objectName;
if(this->GeneratorTarget->ExplicitObjectName.find(&sf) if(this->GeneratorTarget->HasExplicitObjectName(&sf))
!= this->GeneratorTarget->ExplicitObjectName.end())
{ {
objectName = this->GeneratorTarget->Objects[&sf]; objectName = this->GeneratorTarget->GetObjectName(&sf);
} }
std::string flags; std::string flags;
std::string defines; std::string defines;
@ -1882,8 +1893,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
bool cmVisualStudio10TargetGenerator:: bool cmVisualStudio10TargetGenerator::
IsResxHeader(const std::string& headerFile) IsResxHeader(const std::string& headerFile)
{ {
std::set<std::string>::iterator it = std::set<std::string> expectedResxHeaders;
this->GeneratorTarget->ExpectedResxHeaders.find(headerFile); this->GeneratorTarget->GetExpectedResxHeaders(expectedResxHeaders);
return it != this->GeneratorTarget->ExpectedResxHeaders.end(); std::set<std::string>::const_iterator it =
expectedResxHeaders.find(headerFile);
return it != expectedResxHeaders.end();
} }