diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-19 10:21:14 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-01-20 16:06:47 (GMT) |
commit | e98799105bdb296e8d9f5b3ef5cf99bcebcafc40 (patch) | |
tree | 3cc97cedcc2bac471a9868e95a9982d35de6258c /Source | |
parent | d9afacced34b2ef17a6c3ca2f66975272cf8473f (diff) | |
download | CMake-e98799105bdb296e8d9f5b3ef5cf99bcebcafc40.zip CMake-e98799105bdb296e8d9f5b3ef5cf99bcebcafc40.tar.gz CMake-e98799105bdb296e8d9f5b3ef5cf99bcebcafc40.tar.bz2 |
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.cxx | 13 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.h | 3 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 21 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 47 | ||||
-rw-r--r-- | Source/cmTarget.h | 2 |
5 files changed, 86 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 2e5b5ae..057f4c3 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 48f26ed..3169291 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 8e40815a..e842880 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 7a2ead3..c1c484b 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 69a00c1..b3e17b2 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); |