[Cmake-commits] CMake branch, next, updated. v3.0.0-4301-g3703c03
Brad King
brad.king at kitware.com
Wed Jul 16 14:22:10 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 3703c03888e80c56f5bfebc72f6b10fa59f9a8c7 (commit)
via c45dd669abe746de2e9724044591d70397653d98 (commit)
via 89095514a7f6d7075e8d2fda1b88445b87a3bec8 (commit)
via 9d72df45057afd955d6bbb7ee2ceb62ab8dc777a (commit)
via d5f0743d0f97fb44bcfaafd8680a00631d1c7d40 (commit)
via 60bafeb68404dc37434644f56e98000b3b0fff81 (commit)
via 8cb9105431bcc4bd206d92b7cd53cebdb1a783bd (commit)
via 0a8fbac19a1d12adaa10873cc8fdb3dff164c981 (commit)
via fb3518dc81ac1b776503d4369c6d375a706485d1 (commit)
via 535fd6ce6d514deebc8c95424df83f73989f55a5 (commit)
from 20c6cc63a86f2a10e07d540e51aa29d6d5fcb4d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3703c03888e80c56f5bfebc72f6b10fa59f9a8c7
commit 3703c03888e80c56f5bfebc72f6b10fa59f9a8c7
Merge: 20c6cc6 c45dd66
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 16 14:22:08 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jul 16 14:22:08 2014 -0400
Merge topic 'refactor-link-internals' into next
c45dd669 cmTarget: Cache compatible interface property sets
89095514 cmTarget: Refactor GetLinkImplementationClosure internals
9d72df45 Genex: Adjust code layout slightly
d5f0743d Genex: Refactor empty element strip
60bafeb6 Genex: Avoid repeated search of transitive property whitelist
8cb91054 Genex: Simplify TARGET_PROPERTY transitive lookup
0a8fbac1 cmTarget: Drop GetTransitivePropertyTargets method
fb3518dc Refactor system include annotation propagation
535fd6ce cmTarget: Make GetLink*Libraries methods safer to use
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c45dd669abe746de2e9724044591d70397653d98
commit c45dd669abe746de2e9724044591d70397653d98
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 16 11:16:28 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:38:22 2014 -0400
cmTarget: Cache compatible interface property sets
Replace isLinkDependentProperty with a CompatibleInterfaces structure
that records all the compatible interface properties in a set for each
type. This avoids repeatedly traversing the link implementation closure
and asking every target for its compatible interface properties.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d3a9beb..29029eb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -171,6 +171,13 @@ public:
};
std::map<std::string, LinkImplClosure> LinkImplClosureMap;
+ struct CompatibleInterfaces: public cmTarget::CompatibleInterfaces
+ {
+ CompatibleInterfaces(): Done(false) {}
+ bool Done;
+ };
+ std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
+
typedef std::map<std::string, std::vector<cmSourceFile*> >
SourceFilesMapType;
SourceFilesMapType SourceFilesMap;
@@ -5303,44 +5310,6 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
}
//----------------------------------------------------------------------------
-bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
- const std::string& interfaceProperty,
- const std::string& config)
-{
- std::vector<cmTarget const*> const& deps =
- tgt->GetLinkImplementationClosure(config);
-
- if(deps.empty())
- {
- return false;
- }
-
- for(std::vector<cmTarget const*>::const_iterator li = deps.begin();
- li != deps.end(); ++li)
- {
- const char *prop = (*li)->GetProperty(interfaceProperty);
- if (!prop)
- {
- continue;
- }
-
- std::vector<std::string> props;
- cmSystemTools::ExpandListArgument(prop, props);
-
- for(std::vector<std::string>::iterator pi = props.begin();
- pi != props.end(); ++pi)
- {
- if (*pi == p)
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
const std::string& config) const
{
@@ -5349,9 +5318,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
{
return false;
}
- return (p == "POSITION_INDEPENDENT_CODE") ||
- isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_BOOL",
- config);
+ return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0;
}
//----------------------------------------------------------------------------
@@ -5363,9 +5330,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
{
return false;
}
- return (p == "AUTOUIC_OPTIONS") ||
- isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING",
- config);
+ return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0;
}
//----------------------------------------------------------------------------
@@ -5377,8 +5342,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
{
return false;
}
- return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MIN",
- config);
+ return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0;
}
//----------------------------------------------------------------------------
@@ -5390,8 +5354,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
{
return false;
}
- return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_NUMBER_MAX",
- config);
+ return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
}
//----------------------------------------------------------------------------
@@ -6059,6 +6022,40 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
}
//----------------------------------------------------------------------------
+cmTarget::CompatibleInterfaces const&
+cmTarget::GetCompatibleInterfaces(std::string const& config) const
+{
+ cmTargetInternals::CompatibleInterfaces& compat =
+ this->Internal->CompatibleInterfacesMap[config];
+ if(!compat.Done)
+ {
+ compat.Done = true;
+ compat.PropsBool.insert("POSITION_INDEPENDENT_CODE");
+ compat.PropsString.insert("AUTOUIC_OPTIONS");
+ std::vector<cmTarget const*> const& deps =
+ this->GetLinkImplementationClosure(config);
+ for(std::vector<cmTarget const*>::const_iterator li = deps.begin();
+ li != deps.end(); ++li)
+ {
+#define CM_READ_COMPATIBLE_INTERFACE(X, x) \
+ if(const char* prop = (*li)->GetProperty("COMPATIBLE_INTERFACE_" #X)) \
+ { \
+ std::vector<std::string> props; \
+ cmSystemTools::ExpandListArgument(prop, props); \
+ std::copy(props.begin(), props.end(), \
+ std::inserter(compat.Props##x, compat.Props##x.begin())); \
+ }
+ CM_READ_COMPATIBLE_INTERFACE(BOOL, Bool)
+ CM_READ_COMPATIBLE_INTERFACE(STRING, String)
+ CM_READ_COMPATIBLE_INTERFACE(NUMBER_MIN, NumberMin)
+ CM_READ_COMPATIBLE_INTERFACE(NUMBER_MAX, NumberMax)
+#undef CM_READ_COMPATIBLE_INTERFACE
+ }
+ }
+ return compat;
+}
+
+//----------------------------------------------------------------------------
void
cmTargetInternals::ComputeLinkInterfaceLibraries(
cmTarget const* thisTarget,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 1271272..486315e 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -300,6 +300,16 @@ public:
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
+ struct CompatibleInterfaces
+ {
+ std::set<std::string> PropsBool;
+ std::set<std::string> PropsString;
+ std::set<std::string> PropsNumberMax;
+ std::set<std::string> PropsNumberMin;
+ };
+ CompatibleInterfaces const&
+ GetCompatibleInterfaces(std::string const& config) const;
+
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
struct LinkImplementationLibraries
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89095514a7f6d7075e8d2fda1b88445b87a3bec8
commit 89095514a7f6d7075e8d2fda1b88445b87a3bec8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 16 12:58:19 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:38:22 2014 -0400
cmTarget: Refactor GetLinkImplementationClosure internals
Store the 'Done' flag directly in each map entry instead of using a
separate map.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8185bcc..d3a9beb 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -164,6 +164,13 @@ public:
typedef std::map<std::string, cmTarget::LinkClosure> LinkClosureMapType;
LinkClosureMapType LinkClosureMap;
+ struct LinkImplClosure: public std::vector<cmTarget const*>
+ {
+ LinkImplClosure(): Done(false) {}
+ bool Done;
+ };
+ std::map<std::string, LinkImplClosure> LinkImplClosureMap;
+
typedef std::map<std::string, std::vector<cmSourceFile*> >
SourceFilesMapType;
SourceFilesMapType SourceFilesMap;
@@ -203,15 +210,12 @@ public:
CachedLinkInterfaceSourcesEntries;
std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceCompileFeaturesEntries;
- std::map<std::string, std::vector<cmTarget const*> >
- CachedLinkImplementationClosure;
std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone;
std::map<std::string, bool> CacheLinkInterfaceSourcesDone;
std::map<std::string, bool> CacheLinkInterfaceCompileFeaturesDone;
- std::map<std::string, bool> CacheLinkImplementationClosureDone;
};
cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem;
@@ -6034,11 +6038,11 @@ void processILibs(const std::string& config,
std::vector<cmTarget const*> const&
cmTarget::GetLinkImplementationClosure(const std::string& config) const
{
- std::vector<cmTarget const*>& tgts =
- this->Internal->CachedLinkImplementationClosure[config];
- if(!this->Internal->CacheLinkImplementationClosureDone[config])
+ cmTargetInternals::LinkImplClosure& tgts =
+ this->Internal->LinkImplClosureMap[config];
+ if(!tgts.Done)
{
- this->Internal->CacheLinkImplementationClosureDone[config] = true;
+ tgts.Done = true;
std::set<cmTarget const*> emitted;
cmTarget::LinkImplementationLibraries const* impl
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d72df45057afd955d6bbb7ee2ceb62ab8dc777a
commit 9d72df45057afd955d6bbb7ee2ceb62ab8dc777a
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 15:19:44 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:30 2014 -0400
Genex: Adjust code layout slightly
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index db1d180..28879f1 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1039,8 +1039,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
ASSERT_TRANSITIVE_PROPERTY_METHOD)
false);
- }
#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
+ }
}
std::string linkedTargetsContent;
@@ -1090,9 +1090,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
else if(!interfacePropertyName.empty())
{
- const cmTarget::LinkImplementationLibraries *impl
- = target->GetLinkImplementationLibraries(context->Config);
- if(impl)
+ if(cmTarget::LinkImplementationLibraries const* impl =
+ target->GetLinkImplementationLibraries(context->Config))
{
linkedTargetsContent =
getLinkedTargetsContent(impl->Libraries, target,
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5f0743d0f97fb44bcfaafd8680a00631d1c7d40
commit d5f0743d0f97fb44bcfaafd8680a00631d1c7d40
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 15:22:08 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:30 2014 -0400
Genex: Refactor empty element strip
In cmGeneratorExpressionEvaluator, teach getLinkedTargetsContent to call
cmGeneratorExpression::StripEmptyListElements to transform its return
value so that callers do not have to do so.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index ddcc39d..db1d180 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -841,6 +841,8 @@ getLinkedTargetsContent(
context->HadContextSensitiveCondition = true;
}
}
+ linkedTargetsContent =
+ cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
return linkedTargetsContent;
}
@@ -1100,9 +1102,6 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
}
- linkedTargetsContent =
- cmGeneratorExpression::StripEmptyListElements(linkedTargetsContent);
-
if (!prop)
{
if (target->IsImported()
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60bafeb68404dc37434644f56e98000b3b0fff81
commit 60bafeb68404dc37434644f56e98000b3b0fff81
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 15:18:05 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:30 2014 -0400
Genex: Avoid repeated search of transitive property whitelist
In cmGeneratorExpressionEvaluator, avoid searching through the list of
transitive interface property names repeatedly during evaluation of
TargetPropertyNode. Simply record the results of the first search for
later re-use.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index d08c3c9..ddcc39d 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1044,12 +1044,18 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string linkedTargetsContent;
std::string interfacePropertyName;
+ bool isInterfaceProperty = false;
#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
- if (propertyName == #prop || propertyName == "INTERFACE_" #prop) \
+ if (propertyName == #prop) \
{ \
interfacePropertyName = "INTERFACE_" #prop; \
} \
+ else if (propertyName == "INTERFACE_" #prop) \
+ { \
+ interfacePropertyName = "INTERFACE_" #prop; \
+ isInterfaceProperty = true; \
+ } \
else
CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
@@ -1065,17 +1071,10 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
}
#undef POPULATE_INTERFACE_PROPERTY_NAME
-
cmTarget const* headTarget = context->HeadTarget
? context->HeadTarget : target;
- const char * const *transBegin =
- cmArrayBegin(targetPropertyTransitiveWhitelist) + 1;
- const char * const *transEnd =
- cmArrayEnd(targetPropertyTransitiveWhitelist);
-
- if (std::find_if(transBegin, transEnd,
- cmStrCmp(propertyName)) != transEnd)
+ if(isInterfaceProperty)
{
if(cmTarget::LinkInterfaceLibraries const* iface =
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
@@ -1087,18 +1086,17 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
interfacePropertyName);
}
}
- else if (std::find_if(transBegin, transEnd,
- cmStrCmp(interfacePropertyName)) != transEnd)
+ else if(!interfacePropertyName.empty())
{
const cmTarget::LinkImplementationLibraries *impl
= target->GetLinkImplementationLibraries(context->Config);
if(impl)
{
linkedTargetsContent =
- getLinkedTargetsContent(impl->Libraries, target,
- headTarget,
- context, &dagChecker,
- interfacePropertyName);
+ getLinkedTargetsContent(impl->Libraries, target,
+ headTarget,
+ context, &dagChecker,
+ interfacePropertyName);
}
}
@@ -1178,32 +1176,27 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return propContent ? propContent : "";
}
}
- for (size_t i = 1;
- i < cmArraySize(targetPropertyTransitiveWhitelist);
- ++i)
+ if(!interfacePropertyName.empty())
{
- if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)
- {
- cmGeneratorExpression ge(&context->Backtrace);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
- cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
- std::string result = cge->Evaluate(context->Makefile,
+ cmGeneratorExpression ge(&context->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
+ cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
+ std::string result = cge->Evaluate(context->Makefile,
context->Config,
context->Quiet,
headTarget,
target,
&dagChecker);
- if (cge->GetHadContextSensitiveCondition())
- {
- context->HadContextSensitiveCondition = true;
- }
- if (!linkedTargetsContent.empty())
- {
- result += (result.empty() ? "" : ";") + linkedTargetsContent;
- }
- return result;
+ if (cge->GetHadContextSensitiveCondition())
+ {
+ context->HadContextSensitiveCondition = true;
+ }
+ if (!linkedTargetsContent.empty())
+ {
+ result += (result.empty() ? "" : ";") + linkedTargetsContent;
}
+ return result;
}
return prop;
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cb9105431bcc4bd206d92b7cd53cebdb1a783bd
commit 8cb9105431bcc4bd206d92b7cd53cebdb1a783bd
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 11:50:32 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:30 2014 -0400
Genex: Simplify TARGET_PROPERTY transitive lookup
In cmGeneratorExpressionEvaluator, make getLinkedTargetsContent a
template so it can traverse over either the Libraries in a cmTarget
LinkImplementationLibraries or a cmTarget LinkInterfaceLibraries. This
also avoids creating a separate vector<cmTarget*>.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 19b3e16..d08c3c9 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -799,70 +799,49 @@ static const char* targetPropertyTransitiveWhitelist[] = {
#undef TRANSITIVE_PROPERTY_NAME
+template <typename T>
std::string
getLinkedTargetsContent(
- std::vector<cmTarget const*> &targets,
+ std::vector<T> const &libraries,
cmTarget const* target,
cmTarget const* headTarget,
cmGeneratorExpressionContext *context,
cmGeneratorExpressionDAGChecker *dagChecker,
const std::string &interfacePropertyName)
{
- cmGeneratorExpression ge(&context->Backtrace);
-
+ std::string linkedTargetsContent;
std::string sep;
std::string depString;
- for (std::vector<cmTarget const*>::const_iterator
- it = targets.begin();
- it != targets.end(); ++it)
+ for (typename std::vector<T>::const_iterator it = libraries.begin();
+ it != libraries.end(); ++it)
{
- if (*it == target)
- {
- // Broken code can have a target in its own link interface.
- // Don't follow such link interface entries so as not to create a
- // self-referencing loop.
- continue;
+ // Broken code can have a target in its own link interface.
+ // Don't follow such link interface entries so as not to create a
+ // self-referencing loop.
+ if (it->Target && it->Target != target)
+ {
+ depString +=
+ sep + "$<TARGET_PROPERTY:" +
+ it->Target->GetName() + "," + interfacePropertyName + ">";
+ sep = ";";
}
- depString +=
- sep + "$<TARGET_PROPERTY:" +
- (*it)->GetName() + "," + interfacePropertyName + ">";
- sep = ";";
}
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString);
- std::string linkedTargetsContent = cge->Evaluate(target->GetMakefile(),
- context->Config,
- context->Quiet,
- headTarget,
- target,
- dagChecker);
- if (cge->GetHadContextSensitiveCondition())
- {
- context->HadContextSensitiveCondition = true;
- }
- return linkedTargetsContent;
-}
-
-std::string
-getLinkedTargetsContent(
- std::vector<cmLinkImplItem> const &libraries,
- cmTarget const* target,
- cmTarget const* headTarget,
- cmGeneratorExpressionContext *context,
- cmGeneratorExpressionDAGChecker *dagChecker,
- const std::string &interfacePropertyName)
-{
- std::vector<cmTarget const*> tgts;
- for (std::vector<cmLinkImplItem>::const_iterator
- it = libraries.begin();
- it != libraries.end(); ++it)
+ if(!depString.empty())
{
- if (it->Target)
- {
- tgts.push_back(it->Target);
+ cmGeneratorExpression ge(&context->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depString);
+ linkedTargetsContent = cge->Evaluate(target->GetMakefile(),
+ context->Config,
+ context->Quiet,
+ headTarget,
+ target,
+ dagChecker);
+ if (cge->GetHadContextSensitiveCondition())
+ {
+ context->HadContextSensitiveCondition = true;
}
}
- return getLinkedTargetsContent(tgts, target, headTarget, context,
- dagChecker, interfacePropertyName);
+ return linkedTargetsContent;
}
//----------------------------------------------------------------------------
@@ -1098,27 +1077,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (std::find_if(transBegin, transEnd,
cmStrCmp(propertyName)) != transEnd)
{
- std::vector<cmTarget const*> tgts;
if(cmTarget::LinkInterfaceLibraries const* iface =
target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
{
- for(std::vector<cmLinkItem>::const_iterator
- it = iface->Libraries.begin();
- it != iface->Libraries.end(); ++it)
- {
- if (it->Target)
- {
- tgts.push_back(it->Target);
- }
- }
- }
- if (!tgts.empty())
- {
linkedTargetsContent =
- getLinkedTargetsContent(tgts, target,
- headTarget,
- context, &dagChecker,
- interfacePropertyName);
+ getLinkedTargetsContent(iface->Libraries, target,
+ headTarget,
+ context, &dagChecker,
+ interfacePropertyName);
}
}
else if (std::find_if(transBegin, transEnd,
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a8fbac19a1d12adaa10873cc8fdb3dff164c981
commit 0a8fbac19a1d12adaa10873cc8fdb3dff164c981
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 11:42:43 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:29 2014 -0400
cmTarget: Drop GetTransitivePropertyTargets method
Inline the implementation at the only remaining call site.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 1c15bd3..19b3e16 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1098,10 +1098,20 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (std::find_if(transBegin, transEnd,
cmStrCmp(propertyName)) != transEnd)
{
-
std::vector<cmTarget const*> tgts;
- target->GetTransitivePropertyTargets(context->Config,
- headTarget, tgts);
+ if(cmTarget::LinkInterfaceLibraries const* iface =
+ target->GetLinkInterfaceLibraries(context->Config, headTarget, true))
+ {
+ for(std::vector<cmLinkItem>::const_iterator
+ it = iface->Libraries.begin();
+ it != iface->Libraries.end(); ++it)
+ {
+ if (it->Target)
+ {
+ tgts.push_back(it->Target);
+ }
+ }
+ }
if (!tgts.empty())
{
linkedTargetsContent =
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index b36a600..8185bcc 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6055,25 +6055,6 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
}
//----------------------------------------------------------------------------
-void cmTarget::GetTransitivePropertyTargets(const std::string& config,
- cmTarget const* headTarget,
- std::vector<cmTarget const*> &tgts) const
-{
- if(cmTarget::LinkInterfaceLibraries const* iface =
- this->GetLinkInterfaceLibraries(config, headTarget, true))
- {
- for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin();
- it != iface->Libraries.end(); ++it)
- {
- if (it->Target)
- {
- tgts.push_back(it->Target);
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
void
cmTargetInternals::ComputeLinkInterfaceLibraries(
cmTarget const* thisTarget,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 8e21d4f..1271272 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -296,9 +296,6 @@ public:
GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget,
bool usage_requirements_only) const;
- void GetTransitivePropertyTargets(const std::string& config,
- cmTarget const* headTarget,
- std::vector<cmTarget const*> &libs) const;
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fb3518dc81ac1b776503d4369c6d375a706485d1
commit fb3518dc81ac1b776503d4369c6d375a706485d1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 11:39:36 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:29 2014 -0400
Refactor system include annotation propagation
Since commit v3.0.0-rc1~174^2~1 (cmTarget: Fix system include annotation
propagation, 2014-01-01) the cmGeneratorTarget::IsSystemIncludeDirectory
method needs to collect all targets that might provide
INTERFACE_(|SYSTEM)_INCLUDE_DIRECTORIES for the current target. We now
have cmTarget::GetLinkImplementationClosure to provide this, so use it.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 64c5822..f9b68d4 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -445,13 +445,6 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
if (iter == this->SystemIncludesCache.end())
{
- cmTarget::LinkImplementation const* impl
- = this->Target->GetLinkImplementation(config);
- if(!impl)
- {
- return false;
- }
-
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(),
"SYSTEM_INCLUDE_DIRECTORIES", 0, 0);
@@ -471,35 +464,15 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
&dagChecker), result);
}
- std::set<cmTarget const*> uniqueDeps;
- for(std::vector<cmLinkImplItem>::const_iterator
- li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
+ std::vector<cmTarget const*> const& deps =
+ this->Target->GetLinkImplementationClosure(config);
+ for(std::vector<cmTarget const*>::const_iterator
+ li = deps.begin(), le = deps.end(); li != le; ++li)
{
- cmTarget const* tgt = li->Target;
- if (!tgt)
- {
- continue;
- }
-
- if (uniqueDeps.insert(tgt).second)
- {
- handleSystemIncludesDep(this->Makefile, tgt, config, this->Target,
- &dagChecker, result, excludeImported);
-
- std::vector<cmTarget const*> deps;
- tgt->GetTransitivePropertyTargets(config, this->Target, deps);
-
- for(std::vector<cmTarget const*>::const_iterator di = deps.begin();
- di != deps.end(); ++di)
- {
- if (uniqueDeps.insert(*di).second)
- {
- handleSystemIncludesDep(this->Makefile, *di, config, this->Target,
- &dagChecker, result, excludeImported);
- }
- }
- }
+ handleSystemIncludesDep(this->Makefile, *li, config, this->Target,
+ &dagChecker, result, excludeImported);
}
+
std::set<std::string> unique;
for(std::vector<std::string>::iterator li = result.begin();
li != result.end(); ++li)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=535fd6ce6d514deebc8c95424df83f73989f55a5
commit 535fd6ce6d514deebc8c95424df83f73989f55a5
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 15 16:12:07 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Jul 16 13:31:29 2014 -0400
cmTarget: Make GetLink*Libraries methods safer to use
Split the library lists out of LinkImplementation and LinkInterface into
LinkImplementationLibraries and LinkInterfaceLibraries parent classes,
respectively. Return these from GetLinkImplementationLibraries and
GetLinkInterfaceLibraries, respectively, so that callers cannot access
parts of the structures that have not been populated.
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 3b83cd3..1c15bd3 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1114,7 +1114,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
else if (std::find_if(transBegin, transEnd,
cmStrCmp(interfacePropertyName)) != transEnd)
{
- const cmTarget::LinkImplementation *impl
+ const cmTarget::LinkImplementationLibraries *impl
= target->GetLinkImplementationLibraries(context->Config);
if(impl)
{
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index cdece87..b36a600 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4379,7 +4379,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
{
return false;
}
- if(LinkImplementation const* impl =
+ if(LinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config))
{
return !impl->Libraries.empty();
@@ -5935,7 +5935,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
}
//----------------------------------------------------------------------------
-cmTarget::LinkInterface const*
+cmTarget::LinkInterfaceLibraries const*
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* head,
bool usage_requirements_only) const
@@ -6017,7 +6017,7 @@ void processILibs(const std::string& config,
if (item.Target && emitted.insert(item.Target).second)
{
tgts.push_back(item.Target);
- if(cmTarget::LinkInterface const* iface =
+ if(cmTarget::LinkInterfaceLibraries const* iface =
item.Target->GetLinkInterfaceLibraries(config, headTarget, true))
{
for(std::vector<cmLinkItem>::const_iterator
@@ -6041,7 +6041,7 @@ cmTarget::GetLinkImplementationClosure(const std::string& config) const
this->Internal->CacheLinkImplementationClosureDone[config] = true;
std::set<cmTarget const*> emitted;
- cmTarget::LinkImplementation const* impl
+ cmTarget::LinkImplementationLibraries const* impl
= this->GetLinkImplementationLibraries(config);
for(std::vector<cmLinkImplItem>::const_iterator
@@ -6059,7 +6059,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget const*> &tgts) const
{
- if(cmTarget::LinkInterface const* iface =
+ if(cmTarget::LinkInterfaceLibraries const* iface =
this->GetLinkInterfaceLibraries(config, headTarget, true))
{
for(std::vector<cmLinkItem>::const_iterator it = iface->Libraries.begin();
@@ -6177,7 +6177,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// to the link implementation.
{
// The link implementation is the default link interface.
- cmTarget::LinkImplementation const* impl =
+ cmTarget::LinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
std::copy(impl->Libraries.begin(), impl->Libraries.end(),
std::back_inserter(iface.Libraries));
@@ -6294,7 +6294,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
|| thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD)
{
// The link implementation is the default link interface.
- cmTarget::LinkImplementation const*
+ cmTarget::LinkImplementationLibraries const*
impl = thisTarget->GetLinkImplementationLibrariesInternal(config,
headTarget);
iface.ImplementationIsInterface = true;
@@ -6345,7 +6345,7 @@ void cmTargetInternals::AddInterfaceEntries(
cmTarget const* thisTarget, std::string const& config,
std::string const& prop, std::vector<TargetPropertyEntry*>& entries)
{
- if(cmTarget::LinkImplementation const* impl =
+ if(cmTarget::LinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibraries(config))
{
for (std::vector<cmLinkImplItem>::const_iterator
@@ -6383,7 +6383,7 @@ cmTarget::GetLinkImplementation(const std::string& config) const
if(!impl.LibrariesDone)
{
impl.LibrariesDone = true;
- this->ComputeLinkImplementation(config, impl, this);
+ this->ComputeLinkImplementationLibraries(config, impl, this);
}
if(!impl.LanguagesDone)
{
@@ -6394,14 +6394,14 @@ cmTarget::GetLinkImplementation(const std::string& config) const
}
//----------------------------------------------------------------------------
-cmTarget::LinkImplementation const*
+cmTarget::LinkImplementationLibraries const*
cmTarget::GetLinkImplementationLibraries(const std::string& config) const
{
return this->GetLinkImplementationLibrariesInternal(config, this);
}
//----------------------------------------------------------------------------
-cmTarget::LinkImplementation const*
+cmTarget::LinkImplementationLibraries const*
cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const
{
@@ -6418,15 +6418,16 @@ cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config,
if(!impl.LibrariesDone)
{
impl.LibrariesDone = true;
- this->ComputeLinkImplementation(config, impl, head);
+ this->ComputeLinkImplementationLibraries(config, impl, head);
}
return &impl;
}
//----------------------------------------------------------------------------
-void cmTarget::ComputeLinkImplementation(const std::string& config,
- LinkImplementation& impl,
- cmTarget const* head) const
+void
+cmTarget::ComputeLinkImplementationLibraries(const std::string& config,
+ LinkImplementation& impl,
+ cmTarget const* head) const
{
// Collect libraries directly linked in this configuration.
for (std::vector<cmValueWithOrigin>::const_iterator
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 4005443..8e21d4f 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -262,13 +262,15 @@ public:
/** The link interface specifies transitive library dependencies and
other information needed by targets that link to this target. */
- struct LinkInterface
+ struct LinkInterfaceLibraries
{
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
-
// Libraries listed in the interface.
std::vector<cmLinkItem> Libraries;
+ };
+ struct LinkInterface: public LinkInterfaceLibraries
+ {
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
// Shared library dependencies needed for linking on some platforms.
std::vector<cmLinkItem> SharedDeps;
@@ -290,22 +292,21 @@ public:
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
- LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
- cmTarget const* headTarget,
- bool usage_requirements_only) const;
+ LinkInterfaceLibraries const*
+ GetLinkInterfaceLibraries(const std::string& config,
+ cmTarget const* headTarget,
+ bool usage_requirements_only) const;
void GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget const*> &libs) const;
+
std::vector<cmTarget const*> const&
GetLinkImplementationClosure(const std::string& config) const;
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
- struct LinkImplementation
+ struct LinkImplementationLibraries
{
- // Languages whose runtime libraries must be linked.
- std::vector<std::string> Languages;
-
// Libraries linked directly in this configuration.
std::vector<cmLinkImplItem> Libraries;
@@ -313,10 +314,15 @@ public:
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
};
+ struct LinkImplementation: public LinkImplementationLibraries
+ {
+ // Languages whose runtime libraries must be linked.
+ std::vector<std::string> Languages;
+ };
LinkImplementation const*
GetLinkImplementation(const std::string& config) const;
- LinkImplementation const*
+ LinkImplementationLibraries const*
GetLinkImplementationLibraries(const std::string& config) const;
/** Link information from the transitive closure of the link
@@ -778,12 +784,12 @@ private:
GetImportLinkInterface(const std::string& config, cmTarget const* head,
bool usage_requirements_only) const;
- LinkImplementation const*
+ LinkImplementationLibraries const*
GetLinkImplementationLibrariesInternal(const std::string& config,
cmTarget const* head) const;
- void ComputeLinkImplementation(const std::string& config,
- LinkImplementation& impl,
- cmTarget const* head) const;
+ void ComputeLinkImplementationLibraries(const std::string& config,
+ LinkImplementation& impl,
+ cmTarget const* head) const;
void ComputeLinkImplementationLanguages(const std::string& config,
LinkImplementation& impl) const;
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorExpressionEvaluator.cxx | 161 ++++++++++++-----------------
Source/cmGeneratorTarget.cxx | 41 ++------
Source/cmTarget.cxx | 141 +++++++++++--------------
Source/cmTarget.h | 51 +++++----
4 files changed, 165 insertions(+), 229 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list