|
@@ -102,6 +102,26 @@ bool cmGeneratorExpression::Evaluate()
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
|
|
+static bool cmGeneratorExpressionBool(const char* c, std::string& result,
|
|
|
|
|
+ const char* name,
|
|
|
|
|
+ const char* a, const char* b)
|
|
|
|
|
+{
|
|
|
|
|
+ result = a;
|
|
|
|
|
+ while((c[0] == '0' || c[0] == '1') && (c[1] == ',' || c[1] == '>'))
|
|
|
|
|
+ {
|
|
|
|
|
+ if(c[0] == b[0]) { result = b; }
|
|
|
|
|
+ c += 2;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(c[0])
|
|
|
|
|
+ {
|
|
|
|
|
+ result = name;
|
|
|
|
|
+ result += " requires one or more comma-separated '0' or '1' values.";
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result)
|
|
bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result)
|
|
|
{
|
|
{
|
|
@@ -116,6 +136,32 @@ bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result)
|
|
|
{
|
|
{
|
|
|
result = this->Config? this->Config : "";
|
|
result = this->Config? this->Config : "";
|
|
|
}
|
|
}
|
|
|
|
|
+ else if(strncmp(expr, "$<0:",4) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ result = "";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(strncmp(expr, "$<1:",4) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ result = std::string(expr+4, strlen(expr)-5);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(strncmp(expr, "$<NOT:",6) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ const char* c = expr+6;
|
|
|
|
|
+ if((c[0] != '0' && c[0] != '1') || c[1] != '>' || c[2])
|
|
|
|
|
+ {
|
|
|
|
|
+ result = "NOT requires exactly one '0' or '1' value.";
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ result = c[0] == '1'? "0" : "1";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(strncmp(expr, "$<AND:",6) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return cmGeneratorExpressionBool(expr+6, result, "AND", "1", "0");
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(strncmp(expr, "$<OR:",5) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return cmGeneratorExpressionBool(expr+5, result, "OR", "0", "1");
|
|
|
|
|
+ }
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
result = "Expression syntax not recognized.";
|
|
result = "Expression syntax not recognized.";
|