diff options
author | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-22 07:53:44 (GMT) |
---|---|---|
committer | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-23 19:19:15 (GMT) |
commit | 7dcf9cb83c2082168f218be8f21b95b77cc95a86 (patch) | |
tree | ee1435acc933654c5d643e3ca5777670407f2cb1 /Source/cmGeneratorExpression.cxx | |
parent | c7c59dae82594557dc2fddc4ef881dafeaad076a (diff) | |
download | CMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.zip CMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.tar.gz CMake-7dcf9cb83c2082168f218be8f21b95b77cc95a86.tar.bz2 |
cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility
cmGeneratorExpression::Evaluate is a shortcut when only the evaluated string is
needed or an instance of cmCompiledGeneratorExpression cannot be cached.
Fixes: #19686
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r-- | Source/cmGeneratorExpression.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 1bc3452..1f31069 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -36,6 +36,31 @@ std::unique_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( return this->Parse(std::string(input ? input : "")); } +std::string cmGeneratorExpression::Evaluate( + std::string input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget, + cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget, std::string const& language) +{ + if (Find(input) != std::string::npos) { + cmCompiledGeneratorExpression cge(cmListFileBacktrace(), std::move(input)); + return cge.Evaluate(lg, config, headTarget, dagChecker, currentTarget, + language); + } + return input; +} + +std::string cmGeneratorExpression::Evaluate( + const char* input, cmLocalGenerator* lg, const std::string& config, + cmGeneratorTarget const* headTarget, + cmGeneratorExpressionDAGChecker* dagChecker, + cmGeneratorTarget const* currentTarget, std::string const& language) +{ + return input ? Evaluate(std::string(input), lg, config, headTarget, + dagChecker, currentTarget, language) + : ""; +} + const std::string& cmCompiledGeneratorExpression::Evaluate( cmLocalGenerator* lg, const std::string& config, const cmGeneratorTarget* headTarget, |