Merge topic 'refactor-link-internals'
1ca0c0e9
cmTarget: Refactor internal imported LinkInterface map102eea60
cmTarget: Simplify internal ComputeLinkInterfaceLibraries methodb0f57408
cmTarget: Move ComputeLinkInterfaceLibraries to internalsc69e8a55
cmTarget: Refactor internal LinkInterface map4db3990e
cmTarget: Drop 'head' argument from processSources4b8130b8
cmTarget: Drop 'head' argument from GetSourceFiles4c763dd1
cmTarget: Drop 'head' argument from GetLanguages190cabe7
cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguages
This commit is contained in:
commit
a0dc1354fe
|
@ -112,16 +112,22 @@ public:
|
||||||
struct OptionalLinkInterface: public cmTarget::LinkInterface
|
struct OptionalLinkInterface: public cmTarget::LinkInterface
|
||||||
{
|
{
|
||||||
OptionalLinkInterface():
|
OptionalLinkInterface():
|
||||||
Exists(false), Complete(false), ExplicitLibraries(0) {}
|
LibrariesDone(false), AllDone(false),
|
||||||
|
Exists(false), ExplicitLibraries(0) {}
|
||||||
|
bool LibrariesDone;
|
||||||
|
bool AllDone;
|
||||||
bool Exists;
|
bool Exists;
|
||||||
bool Complete;
|
|
||||||
const char* ExplicitLibraries;
|
const char* ExplicitLibraries;
|
||||||
};
|
};
|
||||||
void ComputeLinkInterface(cmTarget const* thisTarget,
|
void ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
OptionalLinkInterface& iface,
|
||||||
cmTarget const* head,
|
cmTarget const* head) const;
|
||||||
const char *explicitLibraries) const;
|
void ComputeLinkInterfaceLibraries(cmTarget const* thisTarget,
|
||||||
|
const std::string& config,
|
||||||
|
OptionalLinkInterface& iface,
|
||||||
|
cmTarget const* head,
|
||||||
|
bool usage_requirements_only);
|
||||||
|
|
||||||
typedef std::map<TargetConfigPair, OptionalLinkInterface>
|
typedef std::map<TargetConfigPair, OptionalLinkInterface>
|
||||||
LinkInterfaceMapType;
|
LinkInterfaceMapType;
|
||||||
|
@ -129,7 +135,7 @@ public:
|
||||||
LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
|
LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
|
||||||
bool PolicyWarnedCMP0022;
|
bool PolicyWarnedCMP0022;
|
||||||
|
|
||||||
typedef std::map<TargetConfigPair, cmTarget::LinkInterface>
|
typedef std::map<TargetConfigPair, OptionalLinkInterface>
|
||||||
ImportLinkInterfaceMapType;
|
ImportLinkInterfaceMapType;
|
||||||
ImportLinkInterfaceMapType ImportLinkInterfaceMap;
|
ImportLinkInterfaceMapType ImportLinkInterfaceMap;
|
||||||
ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap;
|
ImportLinkInterfaceMapType ImportLinkInterfaceUsageRequirementsOnlyMap;
|
||||||
|
@ -158,8 +164,8 @@ public:
|
||||||
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
|
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
|
||||||
LinkClosureMapType LinkClosureMap;
|
LinkClosureMapType LinkClosureMap;
|
||||||
|
|
||||||
typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> >
|
typedef std::map<std::string, std::vector<cmSourceFile*> >
|
||||||
SourceFilesMapType;
|
SourceFilesMapType;
|
||||||
SourceFilesMapType SourceFilesMap;
|
SourceFilesMapType SourceFilesMap;
|
||||||
|
|
||||||
std::set<cmLinkItem> UtilityItems;
|
std::set<cmLinkItem> UtilityItems;
|
||||||
|
@ -631,7 +637,6 @@ static bool processSources(cmTarget const* tgt,
|
||||||
std::vector<std::string> &srcs,
|
std::vector<std::string> &srcs,
|
||||||
std::set<std::string> &uniqueSrcs,
|
std::set<std::string> &uniqueSrcs,
|
||||||
cmGeneratorExpressionDAGChecker *dagChecker,
|
cmGeneratorExpressionDAGChecker *dagChecker,
|
||||||
cmTarget const* head,
|
|
||||||
std::string const& config, bool debugSources)
|
std::string const& config, bool debugSources)
|
||||||
{
|
{
|
||||||
cmMakefile *mf = tgt->GetMakefile();
|
cmMakefile *mf = tgt->GetMakefile();
|
||||||
|
@ -648,7 +653,7 @@ static bool processSources(cmTarget const* tgt,
|
||||||
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
|
cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf,
|
||||||
config,
|
config,
|
||||||
false,
|
false,
|
||||||
head ? head : tgt,
|
tgt,
|
||||||
tgt,
|
tgt,
|
||||||
dagChecker),
|
dagChecker),
|
||||||
entrySources);
|
entrySources);
|
||||||
|
@ -714,8 +719,7 @@ static bool processSources(cmTarget const* tgt,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::GetSourceFiles(std::vector<std::string> &files,
|
void cmTarget::GetSourceFiles(std::vector<std::string> &files,
|
||||||
const std::string& config,
|
const std::string& config) const
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
{
|
||||||
assert(this->GetType() != INTERFACE_LIBRARY);
|
assert(this->GetType() != INTERFACE_LIBRARY);
|
||||||
|
|
||||||
|
@ -779,7 +783,6 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
|
||||||
files,
|
files,
|
||||||
uniqueSrcs,
|
uniqueSrcs,
|
||||||
&dagChecker,
|
&dagChecker,
|
||||||
head,
|
|
||||||
config,
|
config,
|
||||||
debugSources);
|
debugSources);
|
||||||
|
|
||||||
|
@ -796,7 +799,6 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
|
||||||
files,
|
files,
|
||||||
uniqueSrcs,
|
uniqueSrcs,
|
||||||
&dagChecker,
|
&dagChecker,
|
||||||
head,
|
|
||||||
config,
|
config,
|
||||||
debugSources);
|
debugSources);
|
||||||
|
|
||||||
|
@ -875,12 +877,11 @@ cmTarget::GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||||
const std::string& config,
|
const std::string& config) const
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// Lookup any existing link implementation for this configuration.
|
// Lookup any existing link implementation for this configuration.
|
||||||
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
std::string key = cmSystemTools::UpperCase(config);
|
||||||
|
|
||||||
if(!this->LinkImplementationLanguageIsContextDependent)
|
if(!this->LinkImplementationLanguageIsContextDependent)
|
||||||
{
|
{
|
||||||
|
@ -897,7 +898,7 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<std::string> srcs;
|
std::vector<std::string> srcs;
|
||||||
this->GetSourceFiles(srcs, config, head);
|
this->GetSourceFiles(srcs, config);
|
||||||
|
|
||||||
std::set<cmSourceFile*> emitted;
|
std::set<cmSourceFile*> emitted;
|
||||||
|
|
||||||
|
@ -5430,11 +5431,10 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTarget::GetLanguages(std::set<std::string>& languages,
|
void cmTarget::GetLanguages(std::set<std::string>& languages,
|
||||||
const std::string& config,
|
const std::string& config) const
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
{
|
||||||
std::vector<cmSourceFile*> sourceFiles;
|
std::vector<cmSourceFile*> sourceFiles;
|
||||||
this->GetSourceFiles(sourceFiles, config, head);
|
this->GetSourceFiles(sourceFiles, config);
|
||||||
for(std::vector<cmSourceFile*>::const_iterator
|
for(std::vector<cmSourceFile*>::const_iterator
|
||||||
i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
|
i = sourceFiles.begin(); i != sourceFiles.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -5470,7 +5470,7 @@ void cmTarget::GetLanguages(std::set<std::string>& languages,
|
||||||
for(std::vector<cmTarget*>::const_iterator
|
for(std::vector<cmTarget*>::const_iterator
|
||||||
i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
|
i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
|
||||||
{
|
{
|
||||||
(*i)->GetLanguages(languages, config, head);
|
(*i)->GetLanguages(languages, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5912,32 +5912,24 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
|
||||||
// Lookup any existing link interface for this configuration.
|
// Lookup any existing link interface for this configuration.
|
||||||
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
|
||||||
|
|
||||||
cmTargetInternals::LinkInterfaceMapType::iterator
|
cmTargetInternals::OptionalLinkInterface&
|
||||||
i = this->Internal->LinkInterfaceMap.find(key);
|
iface = this->Internal->LinkInterfaceMap[key];
|
||||||
if(i == this->Internal->LinkInterfaceMap.end())
|
if(!iface.LibrariesDone)
|
||||||
{
|
{
|
||||||
// Compute the link interface for this configuration.
|
iface.LibrariesDone = true;
|
||||||
cmTargetInternals::OptionalLinkInterface iface;
|
this->Internal->ComputeLinkInterfaceLibraries(
|
||||||
iface.ExplicitLibraries =
|
this, config, iface, head, false);
|
||||||
this->ComputeLinkInterfaceLibraries(config, iface, head, false,
|
}
|
||||||
iface.Exists);
|
if(!iface.AllDone)
|
||||||
if (iface.Exists)
|
{
|
||||||
|
iface.AllDone = true;
|
||||||
|
if(iface.Exists)
|
||||||
{
|
{
|
||||||
this->Internal->ComputeLinkInterface(this, config, iface,
|
this->Internal->ComputeLinkInterface(this, config, iface, head);
|
||||||
head, iface.ExplicitLibraries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the information for this configuration.
|
|
||||||
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
|
|
||||||
i = this->Internal->LinkInterfaceMap.insert(entry).first;
|
|
||||||
}
|
|
||||||
else if(!i->second.Complete && i->second.Exists)
|
|
||||||
{
|
|
||||||
this->Internal->ComputeLinkInterface(this, config, i->second, head,
|
|
||||||
i->second.ExplicitLibraries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second.Exists ? &i->second : 0;
|
return iface.Exists? &iface : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -5967,22 +5959,15 @@ cmTarget::GetLinkInterfaceLibraries(const std::string& config,
|
||||||
this->Internal->LinkInterfaceUsageRequirementsOnlyMap :
|
this->Internal->LinkInterfaceUsageRequirementsOnlyMap :
|
||||||
this->Internal->LinkInterfaceMap);
|
this->Internal->LinkInterfaceMap);
|
||||||
|
|
||||||
cmTargetInternals::LinkInterfaceMapType::iterator i = lim.find(key);
|
cmTargetInternals::OptionalLinkInterface& iface = lim[key];
|
||||||
if(i == lim.end())
|
if(!iface.LibrariesDone)
|
||||||
{
|
{
|
||||||
// Compute the link interface for this configuration.
|
iface.LibrariesDone = true;
|
||||||
cmTargetInternals::OptionalLinkInterface iface;
|
this->Internal->ComputeLinkInterfaceLibraries(
|
||||||
iface.ExplicitLibraries =
|
this, config, iface, head, usage_requirements_only);
|
||||||
this->ComputeLinkInterfaceLibraries(config, iface, head,
|
|
||||||
usage_requirements_only,
|
|
||||||
iface.Exists);
|
|
||||||
|
|
||||||
// Store the information for this configuration.
|
|
||||||
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
|
|
||||||
i = lim.insert(entry).first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i->second.Exists ? &i->second : 0;
|
return iface.Exists? &iface : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -6003,26 +5988,21 @@ cmTarget::GetImportLinkInterface(const std::string& config,
|
||||||
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap :
|
this->Internal->ImportLinkInterfaceUsageRequirementsOnlyMap :
|
||||||
this->Internal->ImportLinkInterfaceMap);
|
this->Internal->ImportLinkInterfaceMap);
|
||||||
|
|
||||||
cmTargetInternals::ImportLinkInterfaceMapType::iterator i = lim.find(key);
|
cmTargetInternals::OptionalLinkInterface& iface = lim[key];
|
||||||
if(i == lim.end())
|
if(!iface.AllDone)
|
||||||
{
|
{
|
||||||
LinkInterface iface;
|
iface.AllDone = true;
|
||||||
iface.Multiplicity = info->Multiplicity;
|
iface.Multiplicity = info->Multiplicity;
|
||||||
cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
|
cmSystemTools::ExpandListArgument(info->Languages, iface.Languages);
|
||||||
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
|
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
|
||||||
headTarget, usage_requirements_only,
|
headTarget, usage_requirements_only,
|
||||||
iface.Libraries);
|
iface.Libraries);
|
||||||
{
|
|
||||||
std::vector<std::string> deps;
|
std::vector<std::string> deps;
|
||||||
cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
|
cmSystemTools::ExpandListArgument(info->SharedDeps, deps);
|
||||||
this->LookupLinkItems(deps, iface.SharedDeps);
|
this->LookupLinkItems(deps, iface.SharedDeps);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmTargetInternals::ImportLinkInterfaceMapType::value_type
|
return &iface;
|
||||||
entry(key, iface);
|
|
||||||
i = lim.insert(entry).first;
|
|
||||||
}
|
|
||||||
return &i->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -6102,11 +6082,13 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
void
|
||||||
LinkInterface& iface,
|
cmTargetInternals::ComputeLinkInterfaceLibraries(
|
||||||
cmTarget const* headTarget,
|
cmTarget const* thisTarget,
|
||||||
bool usage_requirements_only,
|
const std::string& config,
|
||||||
bool &exists) const
|
OptionalLinkInterface& iface,
|
||||||
|
cmTarget const* headTarget,
|
||||||
|
bool usage_requirements_only)
|
||||||
{
|
{
|
||||||
// Construct the property name suffix for this configuration.
|
// Construct the property name suffix for this configuration.
|
||||||
std::string suffix = "_";
|
std::string suffix = "_";
|
||||||
|
@ -6123,15 +6105,15 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
// libraries and executables that export symbols.
|
// libraries and executables that export symbols.
|
||||||
const char* explicitLibraries = 0;
|
const char* explicitLibraries = 0;
|
||||||
std::string linkIfaceProp;
|
std::string linkIfaceProp;
|
||||||
if(this->PolicyStatusCMP0022 != cmPolicies::OLD &&
|
if(thisTarget->PolicyStatusCMP0022 != cmPolicies::OLD &&
|
||||||
this->PolicyStatusCMP0022 != cmPolicies::WARN)
|
thisTarget->PolicyStatusCMP0022 != cmPolicies::WARN)
|
||||||
{
|
{
|
||||||
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
|
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
|
||||||
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
|
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
|
||||||
explicitLibraries = this->GetProperty(linkIfaceProp);
|
explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
|
||||||
}
|
}
|
||||||
else if(this->GetType() == cmTarget::SHARED_LIBRARY ||
|
else if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||||
this->IsExecutableWithExports())
|
thisTarget->IsExecutableWithExports())
|
||||||
{
|
{
|
||||||
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
|
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
|
||||||
// shared lib or executable.
|
// shared lib or executable.
|
||||||
|
@ -6139,31 +6121,32 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
// Lookup the per-configuration property.
|
// Lookup the per-configuration property.
|
||||||
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
|
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
|
||||||
linkIfaceProp += suffix;
|
linkIfaceProp += suffix;
|
||||||
explicitLibraries = this->GetProperty(linkIfaceProp);
|
explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
|
||||||
|
|
||||||
// If not set, try the generic property.
|
// If not set, try the generic property.
|
||||||
if(!explicitLibraries)
|
if(!explicitLibraries)
|
||||||
{
|
{
|
||||||
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
|
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
|
||||||
explicitLibraries = this->GetProperty(linkIfaceProp);
|
explicitLibraries = thisTarget->GetProperty(linkIfaceProp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(explicitLibraries && this->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
if(explicitLibraries &&
|
||||||
!this->Internal->PolicyWarnedCMP0022)
|
thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
||||||
|
!this->PolicyWarnedCMP0022)
|
||||||
{
|
{
|
||||||
// Compare the explicitly set old link interface properties to the
|
// Compare the explicitly set old link interface properties to the
|
||||||
// preferred new link interface property one and warn if different.
|
// preferred new link interface property one and warn if different.
|
||||||
const char* newExplicitLibraries =
|
const char* newExplicitLibraries =
|
||||||
this->GetProperty("INTERFACE_LINK_LIBRARIES");
|
thisTarget->GetProperty("INTERFACE_LINK_LIBRARIES");
|
||||||
if (newExplicitLibraries
|
if (newExplicitLibraries
|
||||||
&& strcmp(newExplicitLibraries, explicitLibraries) != 0)
|
&& strcmp(newExplicitLibraries, explicitLibraries) != 0)
|
||||||
{
|
{
|
||||||
cmOStringStream w;
|
cmOStringStream w;
|
||||||
w <<
|
w <<
|
||||||
(this->Makefile->GetPolicies()
|
(thisTarget->Makefile->GetPolicies()
|
||||||
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
|
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
|
||||||
"Target \"" << this->GetName() << "\" has an "
|
"Target \"" << thisTarget->GetName() << "\" has an "
|
||||||
"INTERFACE_LINK_LIBRARIES property which differs from its " <<
|
"INTERFACE_LINK_LIBRARIES property which differs from its " <<
|
||||||
linkIfaceProp << " properties."
|
linkIfaceProp << " properties."
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -6171,53 +6154,53 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
" " << newExplicitLibraries << "\n" <<
|
" " << newExplicitLibraries << "\n" <<
|
||||||
linkIfaceProp << ":\n"
|
linkIfaceProp << ":\n"
|
||||||
" " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
|
" " << (explicitLibraries ? explicitLibraries : "(empty)") << "\n";
|
||||||
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
|
thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
|
||||||
this->Internal->PolicyWarnedCMP0022 = true;
|
this->PolicyWarnedCMP0022 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no implicit link interface for executables or modules
|
// There is no implicit link interface for executables or modules
|
||||||
// so if none was explicitly set then there is no link interface.
|
// so if none was explicitly set then there is no link interface.
|
||||||
if(!explicitLibraries &&
|
if(!explicitLibraries &&
|
||||||
(this->GetType() == cmTarget::EXECUTABLE ||
|
(thisTarget->GetType() == cmTarget::EXECUTABLE ||
|
||||||
(this->GetType() == cmTarget::MODULE_LIBRARY)))
|
(thisTarget->GetType() == cmTarget::MODULE_LIBRARY)))
|
||||||
{
|
{
|
||||||
exists = false;
|
return;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
exists = true;
|
iface.Exists = true;
|
||||||
|
iface.ExplicitLibraries = explicitLibraries;
|
||||||
|
|
||||||
if(explicitLibraries)
|
if(explicitLibraries)
|
||||||
{
|
{
|
||||||
// The interface libraries have been explicitly set.
|
// The interface libraries have been explicitly set.
|
||||||
this->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
|
thisTarget->ExpandLinkItems(linkIfaceProp, explicitLibraries, config,
|
||||||
headTarget, usage_requirements_only,
|
headTarget, usage_requirements_only,
|
||||||
iface.Libraries);
|
iface.Libraries);
|
||||||
}
|
}
|
||||||
else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
|
else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN
|
||||||
|| this->PolicyStatusCMP0022 == cmPolicies::OLD)
|
|| thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
|
||||||
// If CMP0022 is NEW then the plain tll signature sets the
|
// If CMP0022 is NEW then the plain tll signature sets the
|
||||||
// INTERFACE_LINK_LIBRARIES, so if we get here then the project
|
// INTERFACE_LINK_LIBRARIES, so if we get here then the project
|
||||||
// cleared the property explicitly and we should not fall back
|
// cleared the property explicitly and we should not fall back
|
||||||
// to the link implementation.
|
// to the link implementation.
|
||||||
{
|
{
|
||||||
// The link implementation is the default link interface.
|
// The link implementation is the default link interface.
|
||||||
LinkImplementation const* impl =
|
cmTarget::LinkImplementation const* impl =
|
||||||
this->GetLinkImplementationLibrariesInternal(config, headTarget);
|
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
|
||||||
std::copy(impl->Libraries.begin(), impl->Libraries.end(),
|
std::copy(impl->Libraries.begin(), impl->Libraries.end(),
|
||||||
std::back_inserter(iface.Libraries));
|
std::back_inserter(iface.Libraries));
|
||||||
if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
|
||||||
!this->Internal->PolicyWarnedCMP0022 && !usage_requirements_only)
|
!this->PolicyWarnedCMP0022 && !usage_requirements_only)
|
||||||
{
|
{
|
||||||
// Compare the link implementation fallback link interface to the
|
// Compare the link implementation fallback link interface to the
|
||||||
// preferred new link interface property and warn if different.
|
// preferred new link interface property and warn if different.
|
||||||
std::vector<cmLinkItem> ifaceLibs;
|
std::vector<cmLinkItem> ifaceLibs;
|
||||||
std::string newProp = "INTERFACE_LINK_LIBRARIES";
|
std::string newProp = "INTERFACE_LINK_LIBRARIES";
|
||||||
if(const char* newExplicitLibraries = this->GetProperty(newProp))
|
if(const char* newExplicitLibraries = thisTarget->GetProperty(newProp))
|
||||||
{
|
{
|
||||||
this->ExpandLinkItems(newProp, newExplicitLibraries, config,
|
thisTarget->ExpandLinkItems(newProp, newExplicitLibraries, config,
|
||||||
headTarget, usage_requirements_only,
|
headTarget, usage_requirements_only,
|
||||||
ifaceLibs);
|
ifaceLibs);
|
||||||
}
|
}
|
||||||
if (ifaceLibs != iface.Libraries)
|
if (ifaceLibs != iface.Libraries)
|
||||||
{
|
{
|
||||||
|
@ -6246,9 +6229,9 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
|
|
||||||
cmOStringStream w;
|
cmOStringStream w;
|
||||||
w <<
|
w <<
|
||||||
(this->Makefile->GetPolicies()
|
(thisTarget->Makefile->GetPolicies()
|
||||||
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
|
->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
|
||||||
"Target \"" << this->GetName() << "\" has an "
|
"Target \"" << thisTarget->GetName() << "\" has an "
|
||||||
"INTERFACE_LINK_LIBRARIES property. "
|
"INTERFACE_LINK_LIBRARIES property. "
|
||||||
"This should be preferred as the source of the link interface "
|
"This should be preferred as the source of the link interface "
|
||||||
"for this library but because CMP0022 is not set CMake is "
|
"for this library but because CMP0022 is not set CMake is "
|
||||||
|
@ -6259,22 +6242,20 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
|
||||||
" " << newLibraries << "\n"
|
" " << newLibraries << "\n"
|
||||||
"Link implementation:\n"
|
"Link implementation:\n"
|
||||||
" " << oldLibraries << "\n";
|
" " << oldLibraries << "\n";
|
||||||
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
|
thisTarget->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
|
||||||
this->Internal->PolicyWarnedCMP0022 = true;
|
this->PolicyWarnedCMP0022 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return explicitLibraries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
OptionalLinkInterface& iface,
|
OptionalLinkInterface& iface,
|
||||||
cmTarget const* headTarget,
|
cmTarget const* headTarget) const
|
||||||
const char* explicitLibraries) const
|
|
||||||
{
|
{
|
||||||
if(explicitLibraries)
|
if(iface.ExplicitLibraries)
|
||||||
{
|
{
|
||||||
if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY
|
if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY
|
||||||
|| thisTarget->GetType() == cmTarget::STATIC_LIBRARY
|
|| thisTarget->GetType() == cmTarget::STATIC_LIBRARY
|
||||||
|
@ -6365,7 +6346,6 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|
||||||
sscanf(reps, "%u", &iface.Multiplicity);
|
sscanf(reps, "%u", &iface.Multiplicity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iface.Complete = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -6416,7 +6396,7 @@ cmTarget::GetLinkImplementation(const std::string& config) const
|
||||||
if(!impl.LanguagesDone)
|
if(!impl.LanguagesDone)
|
||||||
{
|
{
|
||||||
impl.LanguagesDone = true;
|
impl.LanguagesDone = true;
|
||||||
this->ComputeLinkImplementationLanguages(config, impl, this);
|
this->ComputeLinkImplementationLanguages(config, impl);
|
||||||
}
|
}
|
||||||
return &impl;
|
return &impl;
|
||||||
}
|
}
|
||||||
|
@ -6557,13 +6537,12 @@ void cmTarget::ComputeLinkImplementation(const std::string& config,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmTarget::ComputeLinkImplementationLanguages(const std::string& config,
|
cmTarget::ComputeLinkImplementationLanguages(const std::string& config,
|
||||||
LinkImplementation& impl,
|
LinkImplementation& impl) const
|
||||||
cmTarget const* head) const
|
|
||||||
{
|
{
|
||||||
// This target needs runtime libraries for its source languages.
|
// This target needs runtime libraries for its source languages.
|
||||||
std::set<std::string> languages;
|
std::set<std::string> languages;
|
||||||
// Get languages used in our source files.
|
// Get languages used in our source files.
|
||||||
this->GetLanguages(languages, config, head);
|
this->GetLanguages(languages, config);
|
||||||
// Copy the set of langauges to the link implementation.
|
// Copy the set of langauges to the link implementation.
|
||||||
for(std::set<std::string>::iterator li = languages.begin();
|
for(std::set<std::string>::iterator li = languages.begin();
|
||||||
li != languages.end(); ++li)
|
li != languages.end(); ++li)
|
||||||
|
|
|
@ -161,8 +161,7 @@ public:
|
||||||
* Get the list of the source files used by this target
|
* Get the list of the source files used by this target
|
||||||
*/
|
*/
|
||||||
void GetSourceFiles(std::vector<cmSourceFile*> &files,
|
void GetSourceFiles(std::vector<cmSourceFile*> &files,
|
||||||
const std::string& config,
|
const std::string& config) const;
|
||||||
cmTarget const* head = 0) const;
|
|
||||||
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
|
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -489,8 +488,7 @@ public:
|
||||||
// information to forward these property changes to the targets
|
// information to forward these property changes to the targets
|
||||||
// until we have per-target object file properties.
|
// until we have per-target object file properties.
|
||||||
void GetLanguages(std::set<std::string>& languages,
|
void GetLanguages(std::set<std::string>& languages,
|
||||||
std::string const& config,
|
std::string const& config) const;
|
||||||
cmTarget const* head = 0) const;
|
|
||||||
|
|
||||||
/** Return whether this target is an executable with symbol exports
|
/** Return whether this target is an executable with symbol exports
|
||||||
enabled. */
|
enabled. */
|
||||||
|
@ -717,8 +715,7 @@ private:
|
||||||
bool contentOnly) const;
|
bool contentOnly) const;
|
||||||
|
|
||||||
void GetSourceFiles(std::vector<std::string> &files,
|
void GetSourceFiles(std::vector<std::string> &files,
|
||||||
const std::string& config,
|
const std::string& config) const;
|
||||||
cmTarget const* head = 0) const;
|
|
||||||
private:
|
private:
|
||||||
std::string Name;
|
std::string Name;
|
||||||
std::vector<cmCustomCommand> PreBuildCommands;
|
std::vector<cmCustomCommand> PreBuildCommands;
|
||||||
|
@ -781,12 +778,6 @@ private:
|
||||||
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
GetImportLinkInterface(const std::string& config, cmTarget const* head,
|
||||||
bool usage_requirements_only) const;
|
bool usage_requirements_only) const;
|
||||||
|
|
||||||
const char* ComputeLinkInterfaceLibraries(const std::string& config,
|
|
||||||
LinkInterface& iface,
|
|
||||||
cmTarget const* head,
|
|
||||||
bool usage_requirements_only,
|
|
||||||
bool &exists) const;
|
|
||||||
|
|
||||||
LinkImplementation const*
|
LinkImplementation const*
|
||||||
GetLinkImplementationLibrariesInternal(const std::string& config,
|
GetLinkImplementationLibrariesInternal(const std::string& config,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
|
@ -794,8 +785,7 @@ private:
|
||||||
LinkImplementation& impl,
|
LinkImplementation& impl,
|
||||||
cmTarget const* head) const;
|
cmTarget const* head) const;
|
||||||
void ComputeLinkImplementationLanguages(const std::string& config,
|
void ComputeLinkImplementationLanguages(const std::string& config,
|
||||||
LinkImplementation& impl,
|
LinkImplementation& impl) const;
|
||||||
cmTarget const* head) const;
|
|
||||||
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
|
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
|
||||||
|
|
||||||
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
||||||
|
|
Loading…
Reference in New Issue