summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-19 11:21:14 +0100
committerStephen Kelly <steveire@gmail.com>2013-01-20 17:06:47 +0100
commite98799105bdb296e8d9f5b3ef5cf99bcebcafc40 (patch)
tree3cc97cedcc2bac471a9868e95a9982d35de6258c /Source
parentd9afacced34b2ef17a6c3ca2f66975272cf8473f (diff)
downloadcmake-e98799105bdb296e8d9f5b3ef5cf99bcebcafc40.tar.gz
Make INTERFACE determined properties readable in generator expressions.
The properties are evaluated as link-dependent interface properties when evaluating the generator expressions.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx13
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h3
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx21
-rw-r--r--Source/cmTarget.cxx47
-rw-r--r--Source/cmTarget.h2
5 files changed, 86 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 2e5b5ae11f..057f4c3d55 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -106,3 +106,16 @@ cmGeneratorExpressionDAGChecker::checkGraph() const
}
return DAG;
}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries()
+{
+ const cmGeneratorExpressionDAGChecker *top = this;
+ const cmGeneratorExpressionDAGChecker *parent = this->Parent;
+ while (parent)
+ {
+ parent = parent->Parent;
+ top = parent;
+ }
+ return top->Property == "LINK_LIBRARIES";
+}
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 48f26ed38f..31692910da 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -35,6 +35,9 @@ struct cmGeneratorExpressionDAGChecker
void reportError(cmGeneratorExpressionContext *context,
const std::string &expr);
+
+ bool EvaluatingLinkLibraries();
+
private:
Result checkGraph() const;
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 8e40815af7..e84288016e 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -442,6 +442,27 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
const char *prop = target->GetProperty(propertyName.c_str());
if (!prop)
{
+ if (target->IsImported())
+ {
+ return std::string();
+ }
+ if (dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
+ {
+ return std::string();
+ }
+ if (propertyName == "POSITION_INDEPENDENT_CODE")
+ {
+ return target->GetLinkInterfaceDependentBoolProperty(
+ "POSITION_INDEPENDENT_CODE", context->Config) ? "1" : "0";
+ }
+ if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
+ context->Config))
+ {
+ return target->GetLinkInterfaceDependentBoolProperty(
+ propertyName,
+ context->Config) ? "1" : "0";
+ }
+
return std::string();
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7a2ead34c5..c1c484b1e4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4613,6 +4613,53 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
}
//----------------------------------------------------------------------------
+bool isLinkDependentProperty(cmTarget *tgt, const std::string &p,
+ const char *interfaceProperty,
+ const char *config)
+{
+ cmComputeLinkInformation *info = tgt->GetLinkInformation(config);
+
+ const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
+
+ for(cmComputeLinkInformation::ItemVector::const_iterator li =
+ deps.begin();
+ li != deps.end(); ++li)
+ {
+ if (!li->Target)
+ {
+ continue;
+ }
+ const char *prop = li->Target->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 char *config)
+{
+ return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_BOOL",
+ config);
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetLanguages(std::set<cmStdString>& languages) const
{
for(std::vector<cmSourceFile*>::const_iterator
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 69a00c14c1..b3e17b2426 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -495,6 +495,8 @@ public:
void GetLinkDependentTargetsForProperty(const std::string &p,
std::set<std::string> &targets);
bool IsNullImpliedByLinkLibraries(const std::string &p);
+ bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
+ const char *config);
void AddLinkDependentTargetsForProperties(
const std::map<cmStdString, cmStdString> &map);