diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-06-28 09:25:40 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-07-11 09:56:14 (GMT) |
commit | 484bb888a0c84805819749e7899333fc83794857 (patch) | |
tree | 98340e01d8bf9c30bb5cff3e5c9ae9c0630e7f5a /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | 3e30d9ed67f963af15b8d57d24a5fa377299e43a (diff) | |
download | CMake-484bb888a0c84805819749e7899333fc83794857.zip CMake-484bb888a0c84805819749e7899333fc83794857.tar.gz CMake-484bb888a0c84805819749e7899333fc83794857.tar.bz2 |
Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY
Use preprocessor loops and add a unit test for the appropriate
policies. All policies whose value is recorded at target creation
time should be part of this list.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 08d9d03..2bdff78 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1033,10 +1033,13 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode //---------------------------------------------------------------------------- static const char* targetPolicyWhitelist[] = { - "CMP0003" - , "CMP0004" - , "CMP0008" - , "CMP0020" + 0 +#define TARGET_POLICY_STRING(POLICY) \ + , #POLICY + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING) + +#undef TARGET_POLICY_STRING }; cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy) @@ -1047,10 +1050,7 @@ cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy) return tgt->GetPolicyStatus ## POLICY (); \ } \ - RETURN_POLICY(CMP0003) - RETURN_POLICY(CMP0004) - RETURN_POLICY(CMP0008) - RETURN_POLICY(CMP0020) + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY) #undef RETURN_POLICY @@ -1066,10 +1066,7 @@ cmPolicies::PolicyID policyForString(const char *policy_id) return cmPolicies:: POLICY_ID; \ } \ - RETURN_POLICY_ID(CMP0003) - RETURN_POLICY_ID(CMP0004) - RETURN_POLICY_ID(CMP0008) - RETURN_POLICY_ID(CMP0020) + CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID) #undef RETURN_POLICY_ID @@ -1099,7 +1096,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode context->HadContextSensitiveCondition = true; - for (size_t i = 0; + for (size_t i = 1; i < (sizeof(targetPolicyWhitelist) / sizeof(*targetPolicyWhitelist)); ++i) @@ -1125,8 +1122,17 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode } reportError(context, content->GetOriginalExpression(), "$<TARGET_POLICY:prop> may only be used with a limited number of " - "policies. Currently it may be used with policies CMP0003, CMP0004, " - "CMP0008 and CMP0020." + "policies. Currently it may be used with the following policies:\n" + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +#define TARGET_POLICY_LIST_ITEM(POLICY) \ + " * " STRINGIFY(POLICY) "\n" + + CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM) + +#undef TARGET_POLICY_LIST_ITEM ); return std::string(); } |