diff options
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 0f8c4e3..c8010d0 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -82,7 +82,6 @@ static const struct ZeroNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - // Unreachable return std::string(); } } zeroNode; @@ -94,13 +93,12 @@ static const struct OneNode : public cmGeneratorExpressionNode virtual bool AcceptsArbitraryContentParameter() const { return true; } - std::string Evaluate(const std::vector<std::string> &, + std::string Evaluate(const std::vector<std::string> ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - // Unreachable - return std::string(); + return parameters.front(); } } oneNode; @@ -203,6 +201,8 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector<std::string> ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, @@ -217,6 +217,8 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode { UpperCaseNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector<std::string> ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, @@ -231,6 +233,8 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector<std::string> ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, @@ -350,6 +354,7 @@ static const struct CCompilerIdNode : public CompilerIdNode reportError(context, content->GetOriginalExpression(), "$<C_COMPILER_ID> may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "C"); @@ -377,6 +382,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode reportError(context, content->GetOriginalExpression(), "$<CXX_COMPILER_ID> may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "CXX"); @@ -444,6 +450,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode reportError(context, content->GetOriginalExpression(), "$<C_COMPILER_VERSION> may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "C"); @@ -472,6 +479,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode reportError(context, content->GetOriginalExpression(), "$<CXX_COMPILER_VERSION> may only be used with targets. It may " "not be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "CXX"); @@ -504,7 +512,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0) + if (strcmp(parameters.begin()->c_str(), platformId) == 0) { return "1"; } @@ -1634,14 +1642,6 @@ std::string GeneratorExpressionContent::Evaluate( return std::string(); } - if (node->NumExpectedParameters() == 1 - && node->AcceptsArbitraryContentParameter()) - { - return this->ProcessArbitraryContent(node, identifier, context, - dagChecker, - this->ParamChildren.begin()); - } - std::vector<std::string> parameters; this->EvaluateParameters(node, identifier, context, dagChecker, parameters); if (context->HadError) @@ -1669,33 +1669,35 @@ std::string GeneratorExpressionContent::EvaluateParameters( pend = this->ParamChildren.end(); const bool acceptsArbitraryContent = node->AcceptsArbitraryContentParameter(); - for ( ; pit != pend; ++pit) + int counter = 1; + for ( ; pit != pend; ++pit, ++counter) { - std::string parameter; - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - pit->begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = - pit->end(); - for ( ; it != end; ++it) - { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - parameters.push_back(parameter); - if (acceptsArbitraryContent - && parameters.size() == (unsigned int)numExpected - 1) + if (acceptsArbitraryContent && counter == numExpected) { - assert(pit != pend); std::string lastParam = this->ProcessArbitraryContent(node, identifier, context, dagChecker, - pit + 1); + pit); parameters.push_back(lastParam); return std::string(); } + else + { + std::string parameter; + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = + pit->begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = + pit->end(); + for ( ; it != end; ++it) + { + parameter += (*it)->Evaluate(context, dagChecker); + if (context->HadError) + { + return std::string(); + } + } + parameters.push_back(parameter); + } } } |