cmGeneratorTarget: Move computed sources from cmTarget.
This commit is contained in:
parent
7b6dc0fe45
commit
dce6581b7b
|
@ -269,7 +269,9 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
|||
DebugIncludesDone(false),
|
||||
DebugCompileOptionsDone(false),
|
||||
DebugCompileFeaturesDone(false),
|
||||
DebugCompileDefinitionsDone(false)
|
||||
DebugCompileDefinitionsDone(false),
|
||||
DebugSourcesDone(false),
|
||||
LinkImplementationLanguageIsContextDependent(true)
|
||||
{
|
||||
this->Makefile = this->Target->GetMakefile();
|
||||
this->LocalGenerator = lg;
|
||||
|
@ -296,6 +298,11 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
|||
t->GetCompileDefinitionsEntries(),
|
||||
t->GetCompileDefinitionsBacktraces(),
|
||||
this->CompileDefinitionsEntries);
|
||||
|
||||
CreatePropertyGeneratorExpressions(
|
||||
t->GetSourceEntries(),
|
||||
t->GetSourceBacktraces(),
|
||||
this->SourceEntries, true);
|
||||
}
|
||||
|
||||
cmGeneratorTarget::~cmGeneratorTarget()
|
||||
|
@ -304,6 +311,7 @@ cmGeneratorTarget::~cmGeneratorTarget()
|
|||
cmDeleteAll(this->CompileOptionsEntries);
|
||||
cmDeleteAll(this->CompileFeaturesEntries);
|
||||
cmDeleteAll(this->CompileDefinitionsEntries);
|
||||
cmDeleteAll(this->SourceEntries);
|
||||
cmDeleteAll(this->LinkInformation);
|
||||
this->LinkInformation.clear();
|
||||
}
|
||||
|
@ -404,12 +412,32 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
|
|||
|
||||
void cmGeneratorTarget::AddSource(const std::string& src)
|
||||
{
|
||||
this->Target->AddGenerateTimeSource(src);
|
||||
this->Target->AddSource(src);
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
this->SourceEntries.push_back(
|
||||
new TargetPropertyEntry(cge));
|
||||
this->SourceFilesMap.clear();
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
|
||||
{
|
||||
this->Target->AddTracedSources(srcs);
|
||||
if (!srcs.empty())
|
||||
{
|
||||
std::string srcFiles = cmJoin(srcs, ";");
|
||||
this->SourceFilesMap.clear();
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
this->SourceEntries.push_back(
|
||||
new cmGeneratorTarget::TargetPropertyEntry(cge));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -839,29 +867,216 @@ static void AddInterfaceEntries(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||
const std::string& config) const
|
||||
static bool processSources(cmGeneratorTarget const* tgt,
|
||||
const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries,
|
||||
std::vector<std::string> &srcs,
|
||||
UNORDERED_SET<std::string> &uniqueSrcs,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
std::string const& config, bool debugSources)
|
||||
{
|
||||
// Lookup any existing link implementation for this configuration.
|
||||
std::string key = cmSystemTools::UpperCase(config);
|
||||
cmMakefile *mf = tgt->Target->GetMakefile();
|
||||
|
||||
cmTarget::SourceFilesMapType& sfm = this->Target->GetSourceFilesMap();
|
||||
if(!this->Target->GetLinkImplementationLanguageIsContextDependent())
|
||||
bool contextDependent = false;
|
||||
|
||||
for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator
|
||||
it = entries.begin(), end = entries.end(); it != end; ++it)
|
||||
{
|
||||
files = sfm.begin()->second;
|
||||
cmLinkImplItem const& item = (*it)->LinkImplItem;
|
||||
std::string const& targetName = item;
|
||||
std::vector<std::string> entrySources;
|
||||
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
|
||||
config,
|
||||
false,
|
||||
tgt->Target,
|
||||
tgt->Target,
|
||||
dagChecker),
|
||||
entrySources);
|
||||
|
||||
if ((*it)->ge->GetHadContextSensitiveCondition())
|
||||
{
|
||||
contextDependent = true;
|
||||
}
|
||||
|
||||
for(std::vector<std::string>::iterator i = entrySources.begin();
|
||||
i != entrySources.end(); ++i)
|
||||
{
|
||||
std::string& src = *i;
|
||||
cmSourceFile* sf = mf->GetOrCreateSource(src);
|
||||
std::string e;
|
||||
std::string fullPath = sf->GetFullPath(&e);
|
||||
if(fullPath.empty())
|
||||
{
|
||||
if(!e.empty())
|
||||
{
|
||||
cmake* cm = mf->GetCMakeInstance();
|
||||
cm->IssueMessage(cmake::FATAL_ERROR, e,
|
||||
tgt->Target->GetBacktrace());
|
||||
}
|
||||
return contextDependent;
|
||||
}
|
||||
|
||||
if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str()))
|
||||
{
|
||||
std::ostringstream err;
|
||||
if (!targetName.empty())
|
||||
{
|
||||
err << "Target \"" << targetName << "\" contains relative "
|
||||
"path in its INTERFACE_SOURCES:\n"
|
||||
" \"" << src << "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
err << "Found relative path while evaluating sources of "
|
||||
"\"" << tgt->GetName() << "\":\n \"" << src << "\"\n";
|
||||
}
|
||||
tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str());
|
||||
return contextDependent;
|
||||
}
|
||||
src = fullPath;
|
||||
}
|
||||
std::string usedSources;
|
||||
for(std::vector<std::string>::iterator
|
||||
li = entrySources.begin(); li != entrySources.end(); ++li)
|
||||
{
|
||||
std::string src = *li;
|
||||
|
||||
if(uniqueSrcs.insert(src).second)
|
||||
{
|
||||
srcs.push_back(src);
|
||||
if (debugSources)
|
||||
{
|
||||
usedSources += " * " + src + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!usedSources.empty())
|
||||
{
|
||||
mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
|
||||
std::string("Used sources for target ")
|
||||
+ tgt->GetName() + ":\n"
|
||||
+ usedSources, (*it)->ge->GetBacktrace());
|
||||
}
|
||||
}
|
||||
return contextDependent;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GetSourceFiles(std::vector<std::string> &files,
|
||||
const std::string& config) const
|
||||
{
|
||||
assert(this->GetType() != cmTarget::INTERFACE_LIBRARY);
|
||||
|
||||
if (!this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026())
|
||||
{
|
||||
// At configure-time, this method can be called as part of getting the
|
||||
// LOCATION property or to export() a file to be include()d. However
|
||||
// there is no cmGeneratorTarget at configure-time, so search the SOURCES
|
||||
// for TARGET_OBJECTS instead for backwards compatibility with OLD
|
||||
// behavior of CMP0024 and CMP0026 only.
|
||||
|
||||
cmStringRange sourceEntries = this->Target->GetSourceEntries();
|
||||
for(cmStringRange::const_iterator
|
||||
i = sourceEntries.begin();
|
||||
i != sourceEntries.end(); ++i)
|
||||
{
|
||||
std::string const& entry = *i;
|
||||
|
||||
std::vector<std::string> items;
|
||||
cmSystemTools::ExpandListArgument(entry, items);
|
||||
for (std::vector<std::string>::const_iterator
|
||||
li = items.begin(); li != items.end(); ++li)
|
||||
{
|
||||
if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
|
||||
(*li)[li->size() - 1] == '>')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
files.push_back(*li);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cmTarget::SourceFilesMapType::iterator
|
||||
it = sfm.find(key);
|
||||
if(it != sfm.end())
|
||||
std::vector<std::string> debugProperties;
|
||||
const char *debugProp =
|
||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||
if (debugProp)
|
||||
{
|
||||
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
||||
}
|
||||
|
||||
bool debugSources = !this->DebugSourcesDone
|
||||
&& std::find(debugProperties.begin(),
|
||||
debugProperties.end(),
|
||||
"SOURCES")
|
||||
!= debugProperties.end();
|
||||
|
||||
if (this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026())
|
||||
{
|
||||
this->DebugSourcesDone = true;
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
||||
"SOURCES", 0, 0);
|
||||
|
||||
UNORDERED_SET<std::string> uniqueSrcs;
|
||||
bool contextDependentDirectSources = processSources(this,
|
||||
this->SourceEntries,
|
||||
files,
|
||||
uniqueSrcs,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugSources);
|
||||
|
||||
std::vector<cmGeneratorTarget::TargetPropertyEntry*>
|
||||
linkInterfaceSourcesEntries;
|
||||
|
||||
AddInterfaceEntries(
|
||||
this, config, "INTERFACE_SOURCES",
|
||||
linkInterfaceSourcesEntries);
|
||||
|
||||
std::vector<std::string>::size_type numFilesBefore = files.size();
|
||||
bool contextDependentInterfaceSources = processSources(this,
|
||||
linkInterfaceSourcesEntries,
|
||||
files,
|
||||
uniqueSrcs,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugSources);
|
||||
|
||||
if (!contextDependentDirectSources
|
||||
&& !(contextDependentInterfaceSources && numFilesBefore < files.size()))
|
||||
{
|
||||
this->LinkImplementationLanguageIsContextDependent = false;
|
||||
}
|
||||
|
||||
cmDeleteAll(linkInterfaceSourcesEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||
const std::string& config) const
|
||||
{
|
||||
|
||||
// Lookup any existing link implementation for this configuration.
|
||||
std::string key = cmSystemTools::UpperCase(config);
|
||||
|
||||
if(!this->LinkImplementationLanguageIsContextDependent)
|
||||
{
|
||||
files = this->SourceFilesMap.begin()->second;
|
||||
return;
|
||||
}
|
||||
|
||||
SourceFilesMapType::iterator
|
||||
it = this->SourceFilesMap.find(key);
|
||||
if(it != this->SourceFilesMap.end())
|
||||
{
|
||||
files = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> srcs;
|
||||
this->Target->GetSourceFiles(srcs, config);
|
||||
this->GetSourceFiles(srcs, config);
|
||||
|
||||
std::set<cmSourceFile*> emitted;
|
||||
|
||||
|
@ -874,7 +1089,7 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
|||
files.push_back(sf);
|
||||
}
|
||||
}
|
||||
sfm[key] = files;
|
||||
this->SourceFilesMap[key] = files;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -441,10 +441,15 @@ private:
|
|||
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
||||
bool usage_requirements_only) const;
|
||||
|
||||
typedef std::map<std::string, std::vector<cmSourceFile*> >
|
||||
SourceFilesMapType;
|
||||
mutable SourceFilesMapType SourceFilesMap;
|
||||
|
||||
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
||||
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
||||
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
||||
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
||||
std::vector<TargetPropertyEntry*> SourceEntries;
|
||||
|
||||
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||
std::string const& config, cmTarget const* headTarget,
|
||||
|
@ -454,6 +459,9 @@ private:
|
|||
void LookupLinkItems(std::vector<std::string> const& names,
|
||||
std::vector<cmLinkItem>& items) const;
|
||||
|
||||
void GetSourceFiles(std::vector<std::string>& files,
|
||||
const std::string& config) const;
|
||||
|
||||
typedef std::pair<std::string, bool> OutputNameKey;
|
||||
typedef std::map<OutputNameKey, std::string> OutputNameMapType;
|
||||
mutable OutputNameMapType OutputNameMap;
|
||||
|
@ -462,6 +470,8 @@ private:
|
|||
mutable bool DebugCompileOptionsDone;
|
||||
mutable bool DebugCompileFeaturesDone;
|
||||
mutable bool DebugCompileDefinitionsDone;
|
||||
mutable bool DebugSourcesDone;
|
||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||
|
||||
public:
|
||||
std::vector<cmTarget const*> const&
|
||||
|
|
|
@ -101,21 +101,9 @@ public:
|
|||
HeadToLinkImplementationMap> LinkImplMapType;
|
||||
LinkImplMapType LinkImplMap;
|
||||
|
||||
cmTarget::SourceFilesMapType SourceFilesMap;
|
||||
|
||||
std::set<cmLinkItem> UtilityItems;
|
||||
bool UtilityItemsDone;
|
||||
|
||||
class TargetPropertyEntry {
|
||||
static cmLinkImplItem NoLinkImplItem;
|
||||
public:
|
||||
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
|
||||
cmLinkImplItem const& item = NoLinkImplItem)
|
||||
: ge(cge), LinkImplItem(item)
|
||||
{}
|
||||
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge;
|
||||
cmLinkImplItem const& LinkImplItem;
|
||||
};
|
||||
std::vector<std::string> IncludeDirectoriesEntries;
|
||||
std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces;
|
||||
std::vector<std::string> CompileOptionsEntries;
|
||||
|
@ -126,16 +114,9 @@ public:
|
|||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||
std::vector<std::string> SourceEntries;
|
||||
std::vector<cmListFileBacktrace> SourceBacktraces;
|
||||
std::vector<TargetPropertyEntry*> SourceItems;
|
||||
std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries;
|
||||
|
||||
void AddInterfaceEntries(
|
||||
cmTarget const* thisTarget, std::string const& config,
|
||||
std::string const& prop, std::vector<TargetPropertyEntry*>& entries);
|
||||
};
|
||||
|
||||
cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmTargetInternals::~cmTargetInternals()
|
||||
{
|
||||
|
@ -154,8 +135,6 @@ cmTarget::cmTarget()
|
|||
this->IsApple = false;
|
||||
this->IsImportedTarget = false;
|
||||
this->BuildInterfaceIncludesAppended = false;
|
||||
this->DebugSourcesDone = false;
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
}
|
||||
|
||||
void cmTarget::SetType(TargetType type, const std::string& name)
|
||||
|
@ -382,34 +361,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
}
|
||||
}
|
||||
|
||||
void CreatePropertyGeneratorExpressions(
|
||||
std::vector<std::string> const& entries,
|
||||
std::vector<cmListFileBacktrace> const& backtraces,
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>& items,
|
||||
bool evaluateForBuildsystem = false)
|
||||
{
|
||||
std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin();
|
||||
for (std::vector<std::string>::const_iterator it = entries.begin();
|
||||
it != entries.end(); ++it, ++btIt)
|
||||
{
|
||||
cmGeneratorExpression ge(*btIt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
|
||||
cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
|
||||
items.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
}
|
||||
}
|
||||
|
||||
void cmTarget::Compute()
|
||||
{
|
||||
CreatePropertyGeneratorExpressions(
|
||||
this->Internal->SourceEntries,
|
||||
this->Internal->SourceBacktraces,
|
||||
this->Internal->SourceItems, true);
|
||||
}
|
||||
|
||||
cmTarget::SourceFilesMapType& cmTarget::GetSourceFilesMap() const
|
||||
{
|
||||
return this->Internal->SourceFilesMap;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -469,9 +422,7 @@ void cmTarget::FinishConfigure()
|
|||
//----------------------------------------------------------------------------
|
||||
void cmTarget::ClearLinkMaps()
|
||||
{
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
this->Internal->LinkImplMap.clear();
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -552,208 +503,14 @@ bool cmTarget::IsXCTestOnApple() const
|
|||
this->GetPropertyAsBool("XCTEST"));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool processSources(cmTarget const* tgt,
|
||||
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
|
||||
std::vector<std::string> &srcs,
|
||||
UNORDERED_SET<std::string> &uniqueSrcs,
|
||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||
std::string const& config, bool debugSources)
|
||||
{
|
||||
cmMakefile *mf = tgt->GetMakefile();
|
||||
|
||||
bool contextDependent = false;
|
||||
|
||||
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
|
||||
it = entries.begin(), end = entries.end(); it != end; ++it)
|
||||
{
|
||||
cmLinkImplItem const& item = (*it)->LinkImplItem;
|
||||
std::string const& targetName = item;
|
||||
std::vector<std::string> entrySources;
|
||||
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
|
||||
config,
|
||||
false,
|
||||
tgt,
|
||||
tgt,
|
||||
dagChecker),
|
||||
entrySources);
|
||||
|
||||
if ((*it)->ge->GetHadContextSensitiveCondition())
|
||||
{
|
||||
contextDependent = true;
|
||||
}
|
||||
|
||||
for(std::vector<std::string>::iterator i = entrySources.begin();
|
||||
i != entrySources.end(); ++i)
|
||||
{
|
||||
std::string& src = *i;
|
||||
cmSourceFile* sf = mf->GetOrCreateSource(src);
|
||||
std::string e;
|
||||
std::string fullPath = sf->GetFullPath(&e);
|
||||
if(fullPath.empty())
|
||||
{
|
||||
if(!e.empty())
|
||||
{
|
||||
cmake* cm = mf->GetCMakeInstance();
|
||||
cm->IssueMessage(cmake::FATAL_ERROR, e,
|
||||
tgt->GetBacktrace());
|
||||
}
|
||||
return contextDependent;
|
||||
}
|
||||
|
||||
if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str()))
|
||||
{
|
||||
std::ostringstream err;
|
||||
if (!targetName.empty())
|
||||
{
|
||||
err << "Target \"" << targetName << "\" contains relative "
|
||||
"path in its INTERFACE_SOURCES:\n"
|
||||
" \"" << src << "\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
err << "Found relative path while evaluating sources of "
|
||||
"\"" << tgt->GetName() << "\":\n \"" << src << "\"\n";
|
||||
}
|
||||
tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, err.str());
|
||||
return contextDependent;
|
||||
}
|
||||
src = fullPath;
|
||||
}
|
||||
std::string usedSources;
|
||||
for(std::vector<std::string>::iterator
|
||||
li = entrySources.begin(); li != entrySources.end(); ++li)
|
||||
{
|
||||
std::string src = *li;
|
||||
|
||||
if(uniqueSrcs.insert(src).second)
|
||||
{
|
||||
srcs.push_back(src);
|
||||
if (debugSources)
|
||||
{
|
||||
usedSources += " * " + src + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!usedSources.empty())
|
||||
{
|
||||
mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
|
||||
std::string("Used sources for target ")
|
||||
+ tgt->GetName() + ":\n"
|
||||
+ usedSources, (*it)->ge->GetBacktrace());
|
||||
}
|
||||
}
|
||||
return contextDependent;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::GetSourceFiles(std::vector<std::string> &files,
|
||||
const std::string& config) const
|
||||
{
|
||||
assert(this->GetType() != INTERFACE_LIBRARY);
|
||||
|
||||
if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
|
||||
{
|
||||
// At configure-time, this method can be called as part of getting the
|
||||
// LOCATION property or to export() a file to be include()d. However
|
||||
// there is no cmGeneratorTarget at configure-time, so search the SOURCES
|
||||
// for TARGET_OBJECTS instead for backwards compatibility with OLD
|
||||
// behavior of CMP0024 and CMP0026 only.
|
||||
|
||||
for(std::vector<std::string>::const_iterator
|
||||
i = this->Internal->SourceEntries.begin();
|
||||
i != this->Internal->SourceEntries.end(); ++i)
|
||||
{
|
||||
std::string const& entry = *i;
|
||||
|
||||
std::vector<std::string> items;
|
||||
cmSystemTools::ExpandListArgument(entry, items);
|
||||
for (std::vector<std::string>::const_iterator
|
||||
li = items.begin(); li != items.end(); ++li)
|
||||
{
|
||||
if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
|
||||
(*li)[li->size() - 1] == '>')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
files.push_back(*li);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> debugProperties;
|
||||
const char *debugProp =
|
||||
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
|
||||
if (debugProp)
|
||||
{
|
||||
cmSystemTools::ExpandListArgument(debugProp, debugProperties);
|
||||
}
|
||||
|
||||
bool debugSources = !this->DebugSourcesDone
|
||||
&& std::find(debugProperties.begin(),
|
||||
debugProperties.end(),
|
||||
"SOURCES")
|
||||
!= debugProperties.end();
|
||||
|
||||
if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026())
|
||||
{
|
||||
this->DebugSourcesDone = true;
|
||||
}
|
||||
|
||||
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(),
|
||||
"SOURCES", 0, 0);
|
||||
|
||||
UNORDERED_SET<std::string> uniqueSrcs;
|
||||
bool contextDependentDirectSources = processSources(this,
|
||||
this->Internal->SourceItems,
|
||||
files,
|
||||
uniqueSrcs,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugSources);
|
||||
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>
|
||||
linkInterfaceSourcesEntries;
|
||||
|
||||
this->Internal->AddInterfaceEntries(
|
||||
this, config, "INTERFACE_SOURCES",
|
||||
linkInterfaceSourcesEntries);
|
||||
|
||||
std::vector<std::string>::size_type numFilesBefore = files.size();
|
||||
bool contextDependentInterfaceSources = processSources(this,
|
||||
linkInterfaceSourcesEntries,
|
||||
files,
|
||||
uniqueSrcs,
|
||||
&dagChecker,
|
||||
config,
|
||||
debugSources);
|
||||
|
||||
if (!contextDependentDirectSources
|
||||
&& !(contextDependentInterfaceSources && numFilesBefore < files.size()))
|
||||
{
|
||||
this->LinkImplementationLanguageIsContextDependent = false;
|
||||
}
|
||||
|
||||
cmDeleteAll(linkInterfaceSourcesEntries);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
|
||||
{
|
||||
if (!srcs.empty())
|
||||
{
|
||||
std::string srcFiles = cmJoin(srcs, ";");
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->SourceEntries.push_back(srcFiles);
|
||||
this->Internal->SourceEntries.push_back(cmJoin(srcs, ";"));
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
this->Internal->SourceItems.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,8 +543,6 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
|
|||
}
|
||||
if (!srcFiles.empty())
|
||||
{
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->SourceEntries.push_back(srcFiles);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
|
@ -916,8 +671,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
|
|||
TargetPropertyEntryFinder(sfl))
|
||||
== this->Internal->SourceEntries.end())
|
||||
{
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->SourceEntries.push_back(src);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
|
@ -929,17 +682,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
|
|||
return this->Makefile->GetOrCreateSource(src);
|
||||
}
|
||||
|
||||
void cmTarget::AddGenerateTimeSource(const std::string& src)
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
this->Internal->SourceItems.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->AddSource(src);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::MergeLinkLibraries( cmMakefile& mf,
|
||||
const std::string& selfname,
|
||||
|
@ -1234,6 +976,16 @@ cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const
|
|||
return cmMakeRange(this->Internal->CompileDefinitionsBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmTarget::GetSourceEntries() const
|
||||
{
|
||||
return cmMakeRange(this->Internal->SourceEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmTarget::GetSourceBacktraces() const
|
||||
{
|
||||
return cmMakeRange(this->Internal->SourceBacktraces);
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
|
@ -1649,7 +1401,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
|
|||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||
return;
|
||||
}
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
|
||||
this->Internal->SourceEntries.clear();
|
||||
this->Internal->SourceBacktraces.clear();
|
||||
|
@ -1749,7 +1500,6 @@ 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();
|
||||
this->Internal->SourceEntries.push_back(value);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
|
@ -3424,32 +3174,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
|
|||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTargetInternals::AddInterfaceEntries(
|
||||
cmTarget const* thisTarget, std::string const& config,
|
||||
std::string const& prop, std::vector<TargetPropertyEntry*>& entries)
|
||||
{
|
||||
if(cmLinkImplementationLibraries const* impl =
|
||||
thisTarget->GetLinkImplementationLibraries(config))
|
||||
{
|
||||
for (std::vector<cmLinkImplItem>::const_iterator
|
||||
it = impl->Libraries.begin(), end = impl->Libraries.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
if(it->Target)
|
||||
{
|
||||
std::string genex =
|
||||
"$<TARGET_PROPERTY:" + *it + "," + prop + ">";
|
||||
cmGeneratorExpression ge(it->Backtrace);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
entries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge, *it));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmOptionalLinkImplementation&
|
||||
cmTarget::GetLinkImplMap(std::string const& config) const
|
||||
{
|
||||
|
@ -3712,7 +3436,6 @@ cmTargetInternalPointer
|
|||
//----------------------------------------------------------------------------
|
||||
cmTargetInternalPointer::~cmTargetInternalPointer()
|
||||
{
|
||||
cmDeleteAll(this->Pointer->SourceItems);
|
||||
delete this->Pointer;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,15 +135,6 @@ public:
|
|||
|
||||
void Compute();
|
||||
|
||||
typedef std::map<std::string, std::vector<cmSourceFile*> >
|
||||
SourceFilesMapType;
|
||||
|
||||
SourceFilesMapType& GetSourceFilesMap() const;
|
||||
|
||||
bool GetLinkImplementationLanguageIsContextDependent() const {
|
||||
return this->LinkImplementationLanguageIsContextDependent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sources to the target.
|
||||
*/
|
||||
|
@ -151,7 +142,6 @@ public:
|
|||
void AddTracedSources(std::vector<std::string> const& srcs);
|
||||
cmSourceFile* AddSourceCMP0049(const std::string& src);
|
||||
cmSourceFile* AddSource(const std::string& src);
|
||||
void AddGenerateTimeSource(const std::string& src);
|
||||
|
||||
enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
|
||||
|
||||
|
@ -395,6 +385,9 @@ public:
|
|||
cmStringRange GetCompileDefinitionsEntries() const;
|
||||
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
|
||||
|
||||
cmStringRange GetSourceEntries() const;
|
||||
cmBacktraceRange GetSourceBacktraces() const;
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
|
||||
return this->LinkLibrariesForVS6;}
|
||||
|
@ -473,9 +466,6 @@ private:
|
|||
std::string ImportedGetFullPath(const std::string& config,
|
||||
bool implib) const;
|
||||
|
||||
|
||||
void GetSourceFiles(std::vector<std::string> &files,
|
||||
const std::string& config) const;
|
||||
private:
|
||||
mutable cmPropertyMap Properties;
|
||||
std::set<std::string> SystemIncludeDirectories;
|
||||
|
@ -509,8 +499,6 @@ private:
|
|||
bool IsApple;
|
||||
bool IsImportedTarget;
|
||||
bool BuildInterfaceIncludesAppended;
|
||||
mutable bool DebugSourcesDone;
|
||||
mutable bool LinkImplementationLanguageIsContextDependent;
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
bool LinkLibrariesForVS6Analyzed;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue