summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-13 10:07:22 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-02-24 15:43:24 (GMT)
commitd93e1af2928cbb06a66ad67d56c3a5cb217f3963 (patch)
tree489832dfe056c0831a1ce7725d1fb5b852895cc7 /Source
parent3bcb197c11be54445db3282e9811dc29f2321c70 (diff)
downloadCMake-d93e1af2928cbb06a66ad67d56c3a5cb217f3963.zip
CMake-d93e1af2928cbb06a66ad67d56c3a5cb217f3963.tar.gz
CMake-d93e1af2928cbb06a66ad67d56c3a5cb217f3963.tar.bz2
cmTarget: Extract a ComputeLinkInterfaceLibraries method.
When evaluating the SOURCES property, we will need to be able to access the link libraries without accessing the link languages, as the languages depend on the SOURCES.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx161
-rw-r--r--Source/cmTarget.h10
2 files changed, 99 insertions, 72 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index edef7a0..f203312 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -5202,7 +5202,9 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
{
// Compute the link interface for this configuration.
cmTargetInternals::OptionalLinkInterface iface;
- iface.Exists = this->ComputeLinkInterface(config, iface, head);
+ const char* explicitLibraries =
+ this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists);
+ this->ComputeLinkInterface(config, iface, head, explicitLibraries);
// Store the information for this configuration.
cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface);
@@ -5273,8 +5275,10 @@ void cmTarget::GetTransitivePropertyTargets(const char* config,
}
//----------------------------------------------------------------------------
-bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
- cmTarget const* headTarget) const
+const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config,
+ LinkInterface& iface,
+ cmTarget const* headTarget,
+ bool &exists) const
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
@@ -5350,8 +5354,10 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
(this->GetType() == cmTarget::EXECUTABLE ||
(this->GetType() == cmTarget::MODULE_LIBRARY)))
{
- return false;
+ exists = false;
+ return 0;
}
+ exists = true;
if(explicitLibraries)
{
@@ -5378,70 +5384,6 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
LinkImplementation const* impl = this->GetLinkImplementation(config,
headTarget);
iface.Libraries = impl->Libraries;
- }
-
- if(explicitLibraries)
- {
- if(this->GetType() == cmTarget::SHARED_LIBRARY
- || this->GetType() == cmTarget::STATIC_LIBRARY
- || this->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- // Shared libraries may have runtime implementation dependencies
- // on other shared libraries that are not in the interface.
- std::set<cmStdString> emitted;
- for(std::vector<std::string>::const_iterator
- li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
- {
- emitted.insert(*li);
- }
- if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
- {
- LinkImplementation const* impl = this->GetLinkImplementation(config,
- headTarget);
- for(std::vector<std::string>::const_iterator
- li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
- {
- if(emitted.insert(*li).second)
- {
- if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li))
- {
- // This is a runtime dependency on another shared library.
- if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
- {
- iface.SharedDeps.push_back(*li);
- }
- }
- else
- {
- // TODO: Recognize shared library file names. Perhaps this
- // should be moved to cmComputeLinkInformation, but that creates
- // a chicken-and-egg problem since this list is needed for its
- // construction.
- }
- }
- }
- if(this->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- iface.Languages = impl->Languages;
- }
- }
- }
- }
- else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
- || this->PolicyStatusCMP0022 == cmPolicies::OLD)
- {
- // The link implementation is the default link interface.
- LinkImplementation const* impl = this->GetLinkImplementation(config,
- headTarget);
- iface.ImplementationIsInterface = true;
- iface.WrongConfigLibraries = impl->WrongConfigLibraries;
- if(this->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- iface.Languages = impl->Languages;
- }
-
if(this->PolicyStatusCMP0022 == cmPolicies::WARN &&
!this->Internal->PolicyWarnedCMP0022)
{
@@ -5506,9 +5448,90 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
}
+ return explicitLibraries;
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
+ cmTarget const* headTarget,
+ const char* explicitLibraries) const
+{
+ if(explicitLibraries)
+ {
+ if(this->GetType() == cmTarget::SHARED_LIBRARY
+ || this->GetType() == cmTarget::STATIC_LIBRARY
+ || this->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ // Shared libraries may have runtime implementation dependencies
+ // on other shared libraries that are not in the interface.
+ std::set<cmStdString> emitted;
+ for(std::vector<std::string>::const_iterator
+ li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li)
+ {
+ emitted.insert(*li);
+ }
+ if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
+ {
+ LinkImplementation const* impl = this->GetLinkImplementation(config,
+ headTarget);
+ for(std::vector<std::string>::const_iterator
+ li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
+ {
+ if(emitted.insert(*li).second)
+ {
+ if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li))
+ {
+ // This is a runtime dependency on another shared library.
+ if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
+ {
+ iface.SharedDeps.push_back(*li);
+ }
+ }
+ else
+ {
+ // TODO: Recognize shared library file names. Perhaps this
+ // should be moved to cmComputeLinkInformation, but that creates
+ // a chicken-and-egg problem since this list is needed for its
+ // construction.
+ }
+ }
+ }
+ if(this->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ iface.Languages = impl->Languages;
+ }
+ }
+ }
+ }
+ else if (this->PolicyStatusCMP0022 == cmPolicies::WARN
+ || this->PolicyStatusCMP0022 == cmPolicies::OLD)
+ {
+ // The link implementation is the default link interface.
+ LinkImplementation const* impl = this->GetLinkImplementation(config,
+ headTarget);
+ iface.ImplementationIsInterface = true;
+ iface.WrongConfigLibraries = impl->WrongConfigLibraries;
+ if(this->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ iface.Languages = impl->Languages;
+ }
+ }
if(this->GetType() == cmTarget::STATIC_LIBRARY)
{
+ // Construct the property name suffix for this configuration.
+ std::string suffix = "_";
+ if(config && *config)
+ {
+ suffix += cmSystemTools::UpperCase(config);
+ }
+ else
+ {
+ suffix += "NOCONFIG";
+ }
+
// How many repetitions are needed if this library has cyclic
// dependencies?
std::string propName = "LINK_INTERFACE_MULTIPLICITY";
@@ -5523,8 +5546,6 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
sscanf(reps, "%u", &iface.Multiplicity);
}
}
-
- return true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 234adba..09c6f74 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -690,8 +690,14 @@ private:
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
const char* config) const;
- bool ComputeLinkInterface(const char* config, LinkInterface& iface,
- cmTarget const* head) const;
+ void ComputeLinkInterface(const char* config, LinkInterface& iface,
+ cmTarget const* head,
+ const char *explicitLibraries) const;
+
+ const char* ComputeLinkInterfaceLibraries(const char* config,
+ LinkInterface& iface,
+ cmTarget const* head,
+ bool &exists) const;
void ComputeLinkImplementation(const char* config,
LinkImplementation& impl,