Merge topic 'cmGeneratorTarget-sources'
af71c7b4
cmTarget: Remove Compute method.dce6581b
cmGeneratorTarget: Move computed sources from cmTarget.7b6dc0fe
cmGeneratorTarget: Inline GetSourceFiles from cmTarget.33f87bb1
cmGeneratorTarget: Move AddInterfaceEntries method.da1b0449
cmTarget: Remove a conditional for generate-time source addition.fe113f0f
cmTarget: Split storage of sources from genexes.776ff8eb
cmTarget: Add Compute API for sources.64f73150
cmTarget: Add API for generate-time source addition.c38e30f6
cmGeneratorTarget: Add methods for generate-time source addition.5d3776a7
Access sources through cmGeneratorTarget.7ce0991a
GHS: Port API to cmGeneratorTarget.156bd2c9
Xcode: Port away from unnecessary CMP0049 compatibility.01e666c7
cmTarget: Join strings conditionally.bf28b787
cmGeneratorTarget: Rename internal member.9d653f9c
cmFLTKWrapUI: Remove CMake 2.2 compat code.
This commit is contained in:
commit
750391afc1
|
@ -401,7 +401,9 @@ void cmExtraCodeBlocksGenerator
|
|||
case cmTarget::UTILITY: // can have sources since 2.6.3
|
||||
{
|
||||
std::vector<cmSourceFile*> sources;
|
||||
ti->second.GetSourceFiles(sources,
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
|
||||
gt->GetSourceFiles(sources,
|
||||
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
|
||||
si!=sources.end(); si++)
|
||||
|
|
|
@ -196,7 +196,9 @@ void cmExtraCodeLiteGenerator
|
|||
case cmTarget::MODULE_LIBRARY:
|
||||
{
|
||||
std::vector<cmSourceFile*> sources;
|
||||
ti->second.GetSourceFiles(sources,
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
|
||||
gt->GetSourceFiles(sources,
|
||||
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
|
||||
si!=sources.end(); si++)
|
||||
|
|
|
@ -562,7 +562,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
|
|||
// get the files from the source lists then add them to the groups
|
||||
cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
|
||||
std::vector<cmSourceFile*> files;
|
||||
tgt->GetSourceFiles(files,
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(tgt);
|
||||
gt->GetSourceFiles(files,
|
||||
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
|
||||
sfIt != files.end();
|
||||
|
|
|
@ -237,7 +237,7 @@ void cmExtraSublimeTextGenerator::
|
|||
cmGeneratorTarget *gtgt = this->GlobalGenerator
|
||||
->GetGeneratorTarget(target);
|
||||
std::vector<cmSourceFile*> sourceFiles;
|
||||
target->GetSourceFiles(sourceFiles,
|
||||
gtgt->GetSourceFiles(sourceFiles,
|
||||
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
|
||||
sourceFiles.end();
|
||||
|
|
|
@ -129,45 +129,6 @@ void cmFLTKWrapUICommand::FinalPass()
|
|||
cmSystemTools::Message(msg.c_str(),"Warning");
|
||||
return;
|
||||
}
|
||||
std::vector<cmSourceFile*> srcs;
|
||||
target->GetSourceFiles(srcs, "");
|
||||
bool found = false;
|
||||
for (unsigned int i = 0; i < srcs.size(); ++i)
|
||||
{
|
||||
if (srcs[i]->GetFullPath() ==
|
||||
this->GeneratedSourcesClasses[0]->GetFullPath())
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
std::string msg =
|
||||
"In CMake 2.2 the FLTK_WRAP_UI command sets a variable to the list of "
|
||||
"source files that should be added to your executable or library. It "
|
||||
"appears that you have not added these source files to your target. "
|
||||
"You should change your CMakeLists.txt file to "
|
||||
"directly add the generated files to the target. "
|
||||
"For example FTLK_WRAP_UI(foo src1 src2 src3) "
|
||||
"will create a variable named foo_FLTK_UI_SRCS that contains the list "
|
||||
"of sources to add to your target when you call ADD_LIBRARY or "
|
||||
"ADD_EXECUTABLE. For now CMake will add the sources to your target "
|
||||
"for you as was done in CMake 2.0 and earlier. In the future this may "
|
||||
"become an error.";
|
||||
msg +="The problem was found while processing the source directory: ";
|
||||
msg += this->Makefile->GetCurrentSourceDirectory();
|
||||
cmSystemTools::Message(msg.c_str(),"Warning");
|
||||
// first we add the rules for all the .fl to .h and .cxx files
|
||||
size_t lastHeadersClass = this->GeneratedSourcesClasses.size();
|
||||
|
||||
// Generate code for all the .fl files
|
||||
for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
|
||||
{
|
||||
this->Makefile->GetTargets()[this->Target]
|
||||
.AddSource(this->GeneratedSourcesClasses[classNum]->GetFullPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
@ -402,12 +410,42 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
|
|||
return i->second;
|
||||
}
|
||||
|
||||
void cmGeneratorTarget::AddSource(const std::string& 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));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::vector<cmSourceFile*> const*
|
||||
cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
|
||||
{
|
||||
SourceEntriesType::const_iterator i = this->SourceEntries.find(sf);
|
||||
if(i != this->SourceEntries.end())
|
||||
SourceEntriesType::const_iterator i = this->SourceDepends.find(sf);
|
||||
if(i != this->SourceDepends.end())
|
||||
{
|
||||
return &i->second.Depends;
|
||||
}
|
||||
|
@ -449,7 +487,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt,
|
|||
#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \
|
||||
{ \
|
||||
std::vector<cmSourceFile*> sourceFiles; \
|
||||
this->Target->GetSourceFiles(sourceFiles, config); \
|
||||
this->GetSourceFiles(sourceFiles, config); \
|
||||
TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \
|
||||
for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \
|
||||
si != sourceFiles.end(); ++si) \
|
||||
|
@ -801,11 +839,258 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const
|
|||
return this->Target->GetPropertyAsBool(prop);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void AddInterfaceEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& prop,
|
||||
std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
|
||||
{
|
||||
if(cmLinkImplementationLibraries const* impl =
|
||||
thisTarget->Target->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 cmGeneratorTarget::TargetPropertyEntry(cge, *it));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
cmMakefile *mf = tgt->Target->GetMakefile();
|
||||
|
||||
bool contextDependent = false;
|
||||
|
||||
for (std::vector<cmGeneratorTarget::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->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;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
this->Target->GetSourceFiles(files, config);
|
||||
|
||||
// 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->GetSourceFiles(srcs, config);
|
||||
|
||||
std::set<cmSourceFile*> emitted;
|
||||
|
||||
for(std::vector<std::string>::const_iterator i = srcs.begin();
|
||||
i != srcs.end(); ++i)
|
||||
{
|
||||
cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
|
||||
if (emitted.insert(sf).second)
|
||||
{
|
||||
files.push_back(sf);
|
||||
}
|
||||
}
|
||||
this->SourceFilesMap[key] = files;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -1683,7 +1968,7 @@ cmTargetTraceDependencies
|
|||
ci != configs.end(); ++ci)
|
||||
{
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->Target->GetSourceFiles(sources, *ci);
|
||||
this->GeneratorTarget->GetSourceFiles(sources, *ci);
|
||||
for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
|
||||
si != sources.end(); ++si)
|
||||
{
|
||||
|
@ -1723,7 +2008,7 @@ void cmTargetTraceDependencies::Trace()
|
|||
// Get the next source from the queue.
|
||||
cmSourceFile* sf = this->SourceQueue.front();
|
||||
this->SourceQueue.pop();
|
||||
this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf];
|
||||
this->CurrentEntry = &this->GeneratorTarget->SourceDepends[sf];
|
||||
|
||||
// Queue dependencies added explicitly by the user.
|
||||
if(const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS"))
|
||||
|
@ -1755,7 +2040,7 @@ void cmTargetTraceDependencies::Trace()
|
|||
}
|
||||
this->CurrentEntry = 0;
|
||||
|
||||
this->Target->AddTracedSources(this->NewSources);
|
||||
this->GeneratorTarget->AddTracedSources(this->NewSources);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -2167,34 +2452,6 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static void AddInterfaceEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& prop,
|
||||
std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
|
||||
{
|
||||
if(cmLinkImplementationLibraries const* impl =
|
||||
thisTarget->Target->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 cmGeneratorTarget::TargetPropertyEntry(cge, *it));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
std::vector<std::string>
|
||||
cmGeneratorTarget::GetIncludeDirectories(const std::string& config,
|
||||
|
@ -4444,12 +4701,12 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
|
|||
|
||||
std::vector<std::string>::const_iterator it = configs.begin();
|
||||
const std::string& firstConfig = *it;
|
||||
this->Target->GetSourceFiles(files, firstConfig);
|
||||
this->GetSourceFiles(files, firstConfig);
|
||||
|
||||
for ( ; it != configs.end(); ++it)
|
||||
{
|
||||
std::vector<cmSourceFile*> configFiles;
|
||||
this->Target->GetSourceFiles(configFiles, *it);
|
||||
this->GetSourceFiles(configFiles, *it);
|
||||
if (configFiles != files)
|
||||
{
|
||||
std::string firstConfigFiles;
|
||||
|
|
|
@ -296,6 +296,9 @@ public:
|
|||
// Get the target base name.
|
||||
std::string GetOutputName(const std::string& config, bool implib) const;
|
||||
|
||||
void AddSource(const std::string& src);
|
||||
void AddTracedSources(std::vector<std::string> const& srcs);
|
||||
|
||||
/**
|
||||
* Flags for a given source file as used in this target. Typically assigned
|
||||
* via SET_TARGET_PROPERTIES when the property is a list of source files.
|
||||
|
@ -370,7 +373,7 @@ private:
|
|||
friend class cmTargetTraceDependencies;
|
||||
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
||||
typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
|
||||
SourceEntriesType SourceEntries;
|
||||
SourceEntriesType SourceDepends;
|
||||
mutable std::map<cmSourceFile const*, std::string> Objects;
|
||||
std::set<cmSourceFile const*> ExplicitObjectName;
|
||||
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
||||
|
@ -438,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,
|
||||
|
@ -451,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;
|
||||
|
@ -459,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&
|
||||
|
|
|
@ -27,7 +27,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
|
|||
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
|
||||
target->GetLocalGenerator()))
|
||||
, Makefile(target->Target->GetMakefile())
|
||||
, TargetGroup(DetermineIfTargetGroup(target->Target))
|
||||
, TargetGroup(DetermineIfTargetGroup(target))
|
||||
, DynamicDownload(false)
|
||||
{
|
||||
this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target);
|
||||
|
@ -172,16 +172,17 @@ std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const
|
|||
{
|
||||
std::vector<cmSourceFile *> output;
|
||||
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
this->Target->GetSourceFiles(output, config);
|
||||
this->GeneratorTarget->GetSourceFiles(output, config);
|
||||
return output;
|
||||
}
|
||||
|
||||
GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const
|
||||
{
|
||||
return cmGhsMultiTargetGenerator::GetGpjTag(this->Target);
|
||||
return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget);
|
||||
}
|
||||
|
||||
GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(const cmTarget *target)
|
||||
GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(
|
||||
const cmGeneratorTarget *target)
|
||||
{
|
||||
GhsMultiGpj::Types output;
|
||||
if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target))
|
||||
|
@ -566,12 +567,13 @@ bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config,
|
|||
return output;
|
||||
}
|
||||
|
||||
bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(const cmTarget *target)
|
||||
bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
|
||||
const cmGeneratorTarget *target)
|
||||
{
|
||||
bool output = false;
|
||||
std::vector<cmSourceFile *> sources;
|
||||
std::string config =
|
||||
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
target->GetSourceFiles(sources, config);
|
||||
for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin();
|
||||
sources.end() != sources_i; ++sources_i)
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
bool IncludeThisTarget();
|
||||
std::vector<cmSourceFile *> GetSources() const;
|
||||
GhsMultiGpj::Types GetGpjTag() const;
|
||||
static GhsMultiGpj::Types GetGpjTag(const cmTarget *target);
|
||||
static GhsMultiGpj::Types GetGpjTag(const cmGeneratorTarget* target);
|
||||
const char *GetAbsBuildFilePath() const
|
||||
{
|
||||
return this->AbsBuildFilePath.c_str();
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
std::string GetOutputFilename(const std::string &config) const;
|
||||
|
||||
bool IsNotKernel(std::string const &config, const std::string &language);
|
||||
static bool DetermineIfTargetGroup(const cmTarget *target);
|
||||
static bool DetermineIfTargetGroup(const cmGeneratorTarget* target);
|
||||
bool DetermineIfDynamicDownload(std::string const &config,
|
||||
const std::string &language);
|
||||
|
||||
|
|
|
@ -2949,10 +2949,12 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
|
|||
{
|
||||
configs.push_back("");
|
||||
}
|
||||
cmGeneratorTarget* gt =
|
||||
this->GetGeneratorTarget(target);
|
||||
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
||||
ci != configs.end(); ++ci)
|
||||
{
|
||||
target->GetSourceFiles(sources, *ci);
|
||||
gt->GetSourceFiles(sources, *ci);
|
||||
}
|
||||
std::vector<cmSourceFile*>::const_iterator sourcesEnd
|
||||
= cmRemoveDuplicates(sources);
|
||||
|
|
|
@ -509,7 +509,8 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
|
|||
splitPath.back());
|
||||
*this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile
|
||||
<< " ";
|
||||
GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(tgt),
|
||||
GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(
|
||||
tgtsI->second),
|
||||
this->TargetFolderBuildStreams[folderName]);
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +521,8 @@ bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt)
|
|||
const std::string config =
|
||||
tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
std::vector<cmSourceFile *> tgtSources;
|
||||
tgt->GetSourceFiles(tgtSources, config);
|
||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt);
|
||||
gt->GetSourceFiles(tgtSources, config);
|
||||
bool tgtInBuild = true;
|
||||
char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL");
|
||||
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
|
||||
|
|
|
@ -139,7 +139,9 @@ bool cmGlobalKdevelopGenerator
|
|||
ti != targets.end(); ti++)
|
||||
{
|
||||
std::vector<cmSourceFile*> sources;
|
||||
ti->second.GetSourceFiles(sources, ti->second.GetMakefile()
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
|
||||
gt->GetSourceFiles(sources, ti->second.GetMakefile()
|
||||
->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
|
||||
si!=sources.end(); si++)
|
||||
|
|
|
@ -336,7 +336,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
|||
no_main_dependency, commandLines, "Checking Build System",
|
||||
no_working_directory, true))
|
||||
{
|
||||
tgt->AddSource(file->GetFullPath());
|
||||
gt->AddSource(file->GetFullPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -463,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||
std::string listfile = mf->GetCurrentSourceDirectory();
|
||||
listfile += "/";
|
||||
listfile += "CMakeLists.txt";
|
||||
allbuild->AddSourceCMP0049(listfile.c_str());
|
||||
allBuildGt->AddSource(listfile.c_str());
|
||||
|
||||
// Add XCODE depend helper
|
||||
std::string dir = mf->GetCurrentBinaryDirectory();
|
||||
|
@ -553,11 +553,13 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||
allbuild->AddUtility(target.GetName());
|
||||
}
|
||||
|
||||
cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target);
|
||||
|
||||
// Refer to the build configuration file for easy editing.
|
||||
listfile = lg->GetMakefile()->GetCurrentSourceDirectory();
|
||||
listfile += "/";
|
||||
listfile += "CMakeLists.txt";
|
||||
target.AddSourceCMP0049(listfile.c_str());
|
||||
targetGT->AddSource(listfile.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1401,7 +1403,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
|
|||
if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
|
||||
{
|
||||
sf->SetProperty("LANGUAGE", llang.c_str());
|
||||
cmtarget.AddSource(fname);
|
||||
gtgt->AddSource(fname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3069,17 +3071,18 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
|||
continue;
|
||||
}
|
||||
|
||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||
|
||||
// add the soon to be generated Info.plist file as a source for a
|
||||
// MACOSX_BUNDLE file
|
||||
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
|
||||
{
|
||||
std::string plist = this->ComputeInfoPListLocation(cmtarget);
|
||||
mf->GetOrCreateSource(plist, true);
|
||||
cmtarget.AddSource(plist);
|
||||
gtgt->AddSource(plist);
|
||||
}
|
||||
|
||||
std::vector<cmSourceFile*> classes;
|
||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||
if (!gtgt->GetConfigCommonSourceFiles(classes))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -243,7 +243,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
|
|||
no_working_directory, true);
|
||||
if(this->Makefile->GetSource(makefileIn.c_str()))
|
||||
{
|
||||
tgt.AddSource(makefileIn);
|
||||
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&tgt);
|
||||
gt->AddSource(makefileIn);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -595,7 +596,8 @@ cmLocalVisualStudio6Generator
|
|||
origCommand.GetCommandLines(), comment,
|
||||
origCommand.GetWorkingDirectory().c_str()))
|
||||
{
|
||||
target.AddSource(outsf->GetFullPath());
|
||||
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target);
|
||||
gt->AddSource(outsf->GetFullPath());
|
||||
}
|
||||
|
||||
// Replace the dependencies with the output of this rule so that the
|
||||
|
|
|
@ -112,7 +112,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
|
|||
}
|
||||
if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
|
||||
{
|
||||
l->second.AddSource(sf->GetFullPath());
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(&l->second);
|
||||
gt->AddSource(sf->GetFullPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +150,9 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
|
|||
force.c_str(), no_depends, no_main_dependency,
|
||||
force_commands, " ", 0, true))
|
||||
{
|
||||
tgt.AddSource(file->GetFullPath());
|
||||
cmGeneratorTarget* gt =
|
||||
this->GlobalGenerator->GetGeneratorTarget(&tgt);
|
||||
gt->AddSource(file->GetFullPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1149,7 +1149,7 @@ cmMakefileTargetGenerator
|
|||
{
|
||||
// Depend on all custom command outputs.
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->Target->GetSourceFiles(sources,
|
||||
this->GeneratorTarget->GetSourceFiles(sources,
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
|
||||
source != sources.end(); ++source)
|
||||
|
|
|
@ -112,7 +112,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
|
|||
// Write rules for languages compiled in this target.
|
||||
std::set<std::string> languages;
|
||||
std::vector<cmSourceFile*> sourceFiles;
|
||||
this->GetTarget()->GetSourceFiles(sourceFiles,
|
||||
this->GetGeneratorTarget()->GetSourceFiles(sourceFiles,
|
||||
this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
for(std::vector<cmSourceFile*>::const_iterator
|
||||
i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
|
||||
|
|
|
@ -58,7 +58,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
|
|||
std::vector<cmSourceFile*> sources;
|
||||
std::string config = this->GetMakefile()
|
||||
->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
this->GetTarget()->GetSourceFiles(sources, config);
|
||||
this->GetGeneratorTarget()->GetSourceFiles(sources, config);
|
||||
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
|
||||
source != sources.end(); ++source)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
|
|||
fileIt != newRccFiles.end();
|
||||
++fileIt)
|
||||
{
|
||||
const_cast<cmTarget*>(target->Target)->AddSource(*fileIt);
|
||||
const_cast<cmGeneratorTarget*>(target)->AddSource(*fileIt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
|
|||
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||
mocCppFile.c_str(), false);
|
||||
|
||||
target->Target->AddSource(mocCppFile);
|
||||
target->AddSource(mocCppFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,23 +101,9 @@ public:
|
|||
HeadToLinkImplementationMap> LinkImplMapType;
|
||||
LinkImplMapType LinkImplMap;
|
||||
|
||||
typedef std::map<std::string, std::vector<cmSourceFile*> >
|
||||
SourceFilesMapType;
|
||||
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 +112,11 @@ public:
|
|||
std::vector<cmListFileBacktrace> CompileFeaturesBacktraces;
|
||||
std::vector<std::string> CompileDefinitionsEntries;
|
||||
std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces;
|
||||
std::vector<TargetPropertyEntry*> SourceEntries;
|
||||
std::vector<std::string> SourceEntries;
|
||||
std::vector<cmListFileBacktrace> SourceBacktraces;
|
||||
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,21 +361,6 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
}
|
||||
}
|
||||
|
||||
void CreatePropertyGeneratorExpressions(
|
||||
std::vector<std::string> const& entries,
|
||||
std::vector<cmListFileBacktrace> const& backtraces,
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>& items)
|
||||
{
|
||||
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);
|
||||
items.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile)
|
||||
{
|
||||
|
@ -454,9 +418,7 @@ void cmTarget::FinishConfigure()
|
|||
//----------------------------------------------------------------------------
|
||||
void cmTarget::ClearLinkMaps()
|
||||
{
|
||||
this->LinkImplementationLanguageIsContextDependent = true;
|
||||
this->Internal->LinkImplMap.clear();
|
||||
this->Internal->SourceFilesMap.clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -537,248 +499,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.
|
||||
|
||||
typedef cmTargetInternals::TargetPropertyEntry
|
||||
TargetPropertyEntry;
|
||||
for(std::vector<TargetPropertyEntry*>::const_iterator
|
||||
i = this->Internal->SourceEntries.begin();
|
||||
i != this->Internal->SourceEntries.end(); ++i)
|
||||
{
|
||||
std::string entry = (*i)->ge->GetInput();
|
||||
|
||||
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->SourceEntries,
|
||||
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::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->Internal->SourceFilesMap.begin()->second;
|
||||
return;
|
||||
}
|
||||
|
||||
cmTargetInternals::SourceFilesMapType::iterator
|
||||
it = this->Internal->SourceFilesMap.find(key);
|
||||
if(it != this->Internal->SourceFilesMap.end())
|
||||
{
|
||||
files = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::string> srcs;
|
||||
this->GetSourceFiles(srcs, config);
|
||||
|
||||
std::set<cmSourceFile*> emitted;
|
||||
|
||||
for(std::vector<std::string>::const_iterator i = srcs.begin();
|
||||
i != srcs.end(); ++i)
|
||||
{
|
||||
cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
|
||||
if (emitted.insert(sf).second)
|
||||
{
|
||||
files.push_back(sf);
|
||||
}
|
||||
}
|
||||
this->Internal->SourceFilesMap[key] = files;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::AddTracedSources(std::vector<std::string> const& srcs)
|
||||
{
|
||||
std::string srcFiles = cmJoin(srcs, ";");
|
||||
if (!srcFiles.empty())
|
||||
if (!srcs.empty())
|
||||
{
|
||||
this->Internal->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->Internal->SourceEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->Internal->SourceEntries.push_back(cmJoin(srcs, ";"));
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -811,14 +539,9 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
|
|||
}
|
||||
if (!srcFiles.empty())
|
||||
{
|
||||
this->Internal->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->Internal->SourceEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->Internal->SourceEntries.push_back(srcFiles);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -922,10 +645,10 @@ public:
|
|||
|
||||
}
|
||||
|
||||
bool operator()(cmTargetInternals::TargetPropertyEntry* entry)
|
||||
bool operator()(std::string const& entry)
|
||||
{
|
||||
std::vector<std::string> files;
|
||||
cmSystemTools::ExpandListArgument(entry->ge->GetInput(), files);
|
||||
cmSystemTools::ExpandListArgument(entry, files);
|
||||
std::vector<cmSourceFileLocation> locations(files.size());
|
||||
std::transform(files.begin(), files.end(), locations.begin(),
|
||||
CreateLocation(this->Needle.GetMakefile()));
|
||||
|
@ -944,14 +667,9 @@ 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();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
this->Internal->SourceEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->Internal->SourceEntries.push_back(src);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
}
|
||||
if (cmGeneratorExpression::Find(src) != std::string::npos)
|
||||
{
|
||||
|
@ -1254,6 +972,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
|
||||
|
@ -1669,14 +1397,15 @@ 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();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmDeleteAll(this->Internal->SourceEntries);
|
||||
|
||||
this->Internal->SourceEntries.clear();
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
|
||||
this->Internal->SourceEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->Internal->SourceBacktraces.clear();
|
||||
if (value)
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
this->Internal->SourceEntries.push_back(value);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1767,12 +1496,9 @@ 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();
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
|
||||
this->Internal->SourceEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(cge));
|
||||
this->Internal->SourceEntries.push_back(value);
|
||||
this->Internal->SourceBacktraces.push_back(lfbt);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2409,13 +2135,11 @@ const char *cmTarget::GetProperty(const std::string& prop,
|
|||
|
||||
std::ostringstream ss;
|
||||
const char* sep = "";
|
||||
typedef cmTargetInternals::TargetPropertyEntry
|
||||
TargetPropertyEntry;
|
||||
for(std::vector<TargetPropertyEntry*>::const_iterator
|
||||
for(std::vector<std::string>::const_iterator
|
||||
i = this->Internal->SourceEntries.begin();
|
||||
i != this->Internal->SourceEntries.end(); ++i)
|
||||
{
|
||||
std::string entry = (*i)->ge->GetInput();
|
||||
std::string const& entry = *i;
|
||||
|
||||
std::vector<std::string> files;
|
||||
cmSystemTools::ExpandListArgument(entry, files);
|
||||
|
@ -3067,13 +2791,11 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const
|
|||
// 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.
|
||||
typedef cmTargetInternals::TargetPropertyEntry
|
||||
TargetPropertyEntry;
|
||||
for(std::vector<TargetPropertyEntry*>::const_iterator
|
||||
for(std::vector<std::string>::const_iterator
|
||||
i = this->Internal->SourceEntries.begin();
|
||||
i != this->Internal->SourceEntries.end(); ++i)
|
||||
{
|
||||
std::string entry = (*i)->ge->GetInput();
|
||||
std::string const& entry = *i;
|
||||
|
||||
std::vector<std::string> files;
|
||||
cmSystemTools::ExpandListArgument(entry, files);
|
||||
|
@ -3448,32 +3170,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
|
||||
{
|
||||
|
@ -3736,7 +3432,6 @@ cmTargetInternalPointer
|
|||
//----------------------------------------------------------------------------
|
||||
cmTargetInternalPointer::~cmTargetInternalPointer()
|
||||
{
|
||||
cmDeleteAll(this->Pointer->SourceEntries);
|
||||
delete this->Pointer;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,11 +133,6 @@ public:
|
|||
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
||||
{this->PostBuildCommands.push_back(cmd);}
|
||||
|
||||
/**
|
||||
* Get the list of the source files used by this target
|
||||
*/
|
||||
void GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||
const std::string& config) const;
|
||||
/**
|
||||
* Add sources to the target.
|
||||
*/
|
||||
|
@ -388,6 +383,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;}
|
||||
|
@ -466,9 +464,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;
|
||||
|
@ -502,8 +497,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