cmTarget: Remove some hardcoding of transitive property names.

This commit is contained in:
Stephen Kelly 2013-05-16 15:52:14 +02:00
parent 5dd8c01429
commit 53164ac997
1 changed files with 17 additions and 2 deletions

View File

@ -313,6 +313,17 @@ static const char* targetPropertyTransitiveWhitelist[] = {
, "INTERFACE_COMPILE_DEFINITIONS"
};
//----------------------------------------------------------------------------
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
{
@ -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,