summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmTarget.cxx76
-rw-r--r--Source/cmTarget.h3
-rw-r--r--Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt14
3 files changed, 67 insertions, 26 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index eca8bb7..7df2928 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4424,12 +4424,13 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
assert((impliedByUse ^ explicitlySet)
|| (!impliedByUse && !explicitlySet));
- cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
- if(!info)
+ std::vector<cmTarget*> deps;
+ tgt->GetTransitiveTargetClosure(config, tgt, deps);
+
+ if(deps.empty())
{
return propContent;
}
- const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
bool propInitialized = explicitlySet;
std::string report = " * Target \"";
@@ -4449,7 +4450,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
report += "\" property not set.\n";
}
- for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ for(std::vector<cmTarget*>::const_iterator li =
deps.begin();
li != deps.end(); ++li)
{
@@ -4459,11 +4460,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
// target itself has a POSITION_INDEPENDENT_CODE which disagrees
// with a dependency.
- cmTarget const* theTarget = li->Target;
- if (!theTarget)
- {
- continue;
- }
+ cmTarget const* theTarget = *li;
const bool ifaceIsSet = theTarget->GetProperties()
.find("INTERFACE_" + p)
@@ -4643,23 +4640,19 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
const char *interfaceProperty,
const char *config)
{
- cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
- if(!info)
+ std::vector<cmTarget*> deps;
+ tgt->GetTransitiveTargetClosure(config, tgt, deps);
+
+ if(deps.empty())
{
return false;
}
- const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
-
- for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ for(std::vector<cmTarget*>::const_iterator li =
deps.begin();
li != deps.end(); ++li)
{
- if (!li->Target)
- {
- continue;
- }
- const char *prop = li->Target->GetProperty(interfaceProperty);
+ const char *prop = (*li)->GetProperty(interfaceProperty);
if (!prop)
{
continue;
@@ -5278,6 +5271,51 @@ cmTarget::GetLinkInterfaceLibraries(const char* config,
}
//----------------------------------------------------------------------------
+void processILibs(const char* config,
+ cmTarget const* headTarget,
+ std::string const& name,
+ std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted)
+{
+ if (cmTarget* tgt = headTarget->GetMakefile()
+ ->FindTargetToUse(name.c_str()))
+ {
+ if (emitted.insert(tgt).second)
+ {
+ tgts.push_back(tgt);
+ std::vector<std::string> ilibs;
+ cmTarget::LinkInterface const* iface =
+ tgt->GetLinkInterfaceLibraries(config, headTarget);
+ if (iface)
+ {
+ for(std::vector<std::string>::const_iterator
+ it = iface->Libraries.begin();
+ it != iface->Libraries.end(); ++it)
+ {
+ processILibs(config, headTarget, *it, tgts, emitted);
+ }
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::GetTransitiveTargetClosure(const char* config,
+ cmTarget const* headTarget,
+ std::vector<cmTarget*> &tgts) const
+{
+ std::set<cmTarget*> emitted;
+
+ cmTarget::LinkImplementation const* impl
+ = this->GetLinkImplementationLibraries(config, headTarget);
+
+ for(std::vector<std::string>::const_iterator it = impl->Libraries.begin();
+ it != impl->Libraries.end(); ++it)
+ {
+ processILibs(config, headTarget, *it, tgts, emitted);
+ }
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetTransitivePropertyTargets(const char* config,
cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index f3cd874..5dec9e2 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -269,6 +269,9 @@ public:
void GetTransitivePropertyTargets(const char* config,
cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const;
+ void GetTransitiveTargetClosure(const char* config,
+ cmTarget const* headTarget,
+ std::vector<cmTarget*> &libs) const;
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
index 17b8a5c..82a34d5 100644
--- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
+++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt
@@ -1,4 +1,11 @@
CMake Debug Log:
+ Boolean compatibility of property "BOOL_PROP7" for target
+ "CompatibleInterface" \(result: "FALSE"\):
+
+ \* Target "CompatibleInterface" property is implied by use.
+ \* Target "iface1" property value "FALSE" \(Agree\)
++
+CMake Debug Log:
Boolean compatibility of property "BOOL_PROP1" for target
"CompatibleInterface" \(result: "TRUE"\):
@@ -40,13 +47,6 @@ CMake Debug Log:
\* Target "iface2" property value "FALSE" \(Agree\)
+
CMake Debug Log:
- Boolean compatibility of property "BOOL_PROP7" for target
- "CompatibleInterface" \(result: "FALSE"\):
-
- \* Target "CompatibleInterface" property is implied by use.
- \* Target "iface1" property value "FALSE" \(Agree\)
-+
-CMake Debug Log:
String compatibility of property "STRING_PROP1" for target
"CompatibleInterface" \(result: "prop1"\):