Browse Source

Genex: Use a preprocessor foreach to follow transitive properties.

Stephen Kelly 12 years ago
parent
commit
77a0fd5135
1 changed files with 12 additions and 17 deletions
  1. 12 17
      Source/cmGeneratorExpressionEvaluator.cxx

+ 12 - 17
Source/cmGeneratorExpressionEvaluator.cxx

@@ -893,26 +893,21 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
     std::string interfacePropertyName;
 
-    if (propertyName == "INTERFACE_INCLUDE_DIRECTORIES"
-        || propertyName == "INCLUDE_DIRECTORIES")
-      {
-      interfacePropertyName = "INTERFACE_INCLUDE_DIRECTORIES";
-      }
-    else if (propertyName == "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES")
-      {
-      interfacePropertyName = "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES";
-      }
-    else if (propertyName == "INTERFACE_COMPILE_DEFINITIONS"
-        || propertyName == "COMPILE_DEFINITIONS"
-        || strncmp(propertyName.c_str(), "COMPILE_DEFINITIONS_", 20) == 0)
+#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
+    if (propertyName == #prop || propertyName == "INTERFACE_" #prop) \
+      { \
+      interfacePropertyName = "INTERFACE_" #prop; \
+      } \
+    else
+
+    CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
+      // Note that the above macro terminates with an else
+    /* else */ if (strncmp(propertyName.c_str(),
+                           "COMPILE_DEFINITIONS_", 20) == 0)
       {
       interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
       }
-    else if (propertyName == "INTERFACE_COMPILE_OPTIONS"
-        || propertyName == "COMPILE_OPTIONS")
-      {
-      interfacePropertyName = "INTERFACE_COMPILE_OPTIONS";
-      }
+#undef POPULATE_INTERFACE_PROPERTY_NAME
 
     cmTarget const* headTarget = context->HeadTarget
                                ? context->HeadTarget : target;