|
|
@@ -138,6 +138,10 @@ public:
|
|
|
LinkClosureMapType;
|
|
|
LinkClosureMapType LinkClosureMap;
|
|
|
|
|
|
+ typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> >
|
|
|
+ SourceFilesMapType;
|
|
|
+ SourceFilesMapType SourceFilesMap;
|
|
|
+
|
|
|
struct TargetPropertyEntry {
|
|
|
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
|
|
|
const std::string &targetName = std::string())
|
|
|
@@ -793,42 +797,75 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
|
|
const std::string& config,
|
|
|
cmTarget const* head) const
|
|
|
{
|
|
|
- std::vector<std::string> srcs;
|
|
|
- this->GetSourceFiles(srcs, config, head);
|
|
|
|
|
|
- std::set<cmSourceFile*> emitted;
|
|
|
+ // Lookup any existing link implementation for this configuration.
|
|
|
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
|
|
|
|
|
- for(std::vector<std::string>::const_iterator i = srcs.begin();
|
|
|
- i != srcs.end(); ++i)
|
|
|
+ cmTargetInternals::SourceFilesMapType::iterator
|
|
|
+ it = this->Internal->SourceFilesMap.find(key);
|
|
|
+ if(it != this->Internal->SourceFilesMap.end())
|
|
|
{
|
|
|
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
|
|
|
- if (emitted.insert(sf).second)
|
|
|
+ files = it->second;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::vector<std::string> srcs;
|
|
|
+ this->GetSourceFiles(srcs, config, head);
|
|
|
+
|
|
|
+ std::set<cmSourceFile*> emitted;
|
|
|
+
|
|
|
+ for(std::vector<std::string>::const_iterator i = srcs.begin();
|
|
|
+ i != srcs.end(); ++i)
|
|
|
{
|
|
|
- files.push_back(sf);
|
|
|
+ cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
|
|
|
+ if (emitted.insert(sf).second)
|
|
|
+ {
|
|
|
+ files.push_back(sf);
|
|
|
+ }
|
|
|
}
|
|
|
+ this->Internal->SourceFilesMap[key] = files;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
void cmTarget::AddSources(std::vector<std::string> const& srcs)
|
|
|
{
|
|
|
+ std::string srcFiles;
|
|
|
+ const char* sep = "";
|
|
|
for(std::vector<std::string>::const_iterator i = srcs.begin();
|
|
|
i != srcs.end(); ++i)
|
|
|
{
|
|
|
- const char* src = i->c_str();
|
|
|
- if(src[0] == '$' && src[1] == '<')
|
|
|
- {
|
|
|
- this->AddSource(src);
|
|
|
- }
|
|
|
- else
|
|
|
+ std::string filename = *i;
|
|
|
+ const char* src = filename.c_str();
|
|
|
+
|
|
|
+ if(!(src[0] == '$' && src[1] == '<'))
|
|
|
{
|
|
|
- this->AddSourceCMP0049(src);
|
|
|
+ filename = this->ProcessSourceItemCMP0049(filename);
|
|
|
+ if (cmSystemTools::GetErrorOccuredFlag())
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this->Makefile->GetOrCreateSource(filename);
|
|
|
}
|
|
|
+ srcFiles += sep;
|
|
|
+ srcFiles += filename;
|
|
|
+ sep = ";";
|
|
|
+ }
|
|
|
+ if (!srcFiles.empty())
|
|
|
+ {
|
|
|
+ this->Internal->SourceFilesMap.clear();
|
|
|
+ cmListFileBacktrace lfbt;
|
|
|
+ this->Makefile->GetBacktrace(lfbt);
|
|
|
+ cmGeneratorExpression ge(lfbt);
|
|
|
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
|
|
|
+ cge->SetEvaluateForBuildsystem(true);
|
|
|
+ this->Internal->SourceEntries.push_back(
|
|
|
+ new cmTargetInternals::TargetPropertyEntry(cge));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
-cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
|
|
|
+std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s)
|
|
|
{
|
|
|
std::string src = s;
|
|
|
|
|
|
@@ -863,10 +900,22 @@ cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
|
|
|
this->Makefile->IssueMessage(messageType, e.str());
|
|
|
if (messageType == cmake::FATAL_ERROR)
|
|
|
{
|
|
|
- return 0;
|
|
|
+ return "";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return src;
|
|
|
+}
|
|
|
+
|
|
|
+//----------------------------------------------------------------------------
|
|
|
+cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
|
|
|
+{
|
|
|
+ std::string src = this->ProcessSourceItemCMP0049(s);
|
|
|
+
|
|
|
+ if (cmSystemTools::GetErrorOccuredFlag())
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
return this->AddSource(src);
|
|
|
}
|
|
|
|
|
|
@@ -939,6 +988,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
|
|
|
TargetPropertyEntryFinder(sfl))
|
|
|
== this->Internal->SourceEntries.end())
|
|
|
{
|
|
|
+ this->Internal->SourceFilesMap.clear();
|
|
|
cmListFileBacktrace lfbt;
|
|
|
this->Makefile->GetBacktrace(lfbt);
|
|
|
cmGeneratorExpression ge(lfbt);
|
|
|
@@ -1708,6 +1758,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return;
|
|
|
}
|
|
|
+ this->Internal->SourceFilesMap.clear();
|
|
|
cmListFileBacktrace lfbt;
|
|
|
this->Makefile->GetBacktrace(lfbt);
|
|
|
cmGeneratorExpression ge(lfbt);
|
|
|
@@ -1794,7 +1845,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
|
|
|
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ this->Internal->SourceFilesMap.clear();
|
|
|
cmListFileBacktrace lfbt;
|
|
|
this->Makefile->GetBacktrace(lfbt);
|
|
|
cmGeneratorExpression ge(lfbt);
|