diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-16 13:52:14 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-05-30 13:43:37 (GMT) |
commit | 53164ac997f6ce2a4fd1245956a815bfdb893c27 (patch) | |
tree | a1f6326dab8bd4758718422c20f229396a2b79b1 /Source | |
parent | 5dd8c01429da90a7417b72f17e784cc98f70f57c (diff) | |
download | CMake-53164ac997f6ce2a4fd1245956a815bfdb893c27.zip CMake-53164ac997f6ce2a4fd1245956a815bfdb893c27.tar.gz CMake-53164ac997f6ce2a4fd1245956a815bfdb893c27.tar.bz2 |
cmTarget: Remove some hardcoding of transitive property names.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6618e83..60c969e 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -314,6 +314,17 @@ static const char* targetPropertyTransitiveWhitelist[] = { }; //---------------------------------------------------------------------------- +struct TransitiveWhitelistCompare +{ + explicit TransitiveWhitelistCompare(const std::string &needle) + : Needle(needle) {} + bool operator() (const char *item) + { return strcmp(item, this->Needle.c_str()) == 0; } +private: + std::string Needle; +}; + +//---------------------------------------------------------------------------- static const struct TargetPropertyNode : public cmGeneratorExpressionNode { TargetPropertyNode() {} @@ -485,8 +496,12 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS"; } - if (interfacePropertyName == "INTERFACE_INCLUDE_DIRECTORIES" - || interfacePropertyName == "INTERFACE_COMPILE_DEFINITIONS") + const char **transBegin = targetPropertyTransitiveWhitelist; + const char **transEnd = targetPropertyTransitiveWhitelist + + (sizeof(targetPropertyTransitiveWhitelist) / + sizeof(*targetPropertyTransitiveWhitelist)); + if (std::find_if(transBegin, transEnd, + TransitiveWhitelistCompare(interfacePropertyName)) != transEnd) { const cmTarget::LinkInterface *iface = target->GetLinkInterface( context->Config, |