mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Refactor: Move version compare op table out of the function
It's static data and never changed.
This commit is contained in:
@@ -59,6 +59,12 @@ auto const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL"_s;
|
|||||||
auto const keyVERSION_LESS = "VERSION_LESS"_s;
|
auto const keyVERSION_LESS = "VERSION_LESS"_s;
|
||||||
auto const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"_s;
|
auto const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"_s;
|
||||||
|
|
||||||
|
cmSystemTools::CompareOp const MATCH2CMPOP[5] = {
|
||||||
|
cmSystemTools::OP_LESS, cmSystemTools::OP_LESS_EQUAL,
|
||||||
|
cmSystemTools::OP_GREATER, cmSystemTools::OP_GREATER_EQUAL,
|
||||||
|
cmSystemTools::OP_EQUAL
|
||||||
|
};
|
||||||
|
|
||||||
// Run-Time to Compile-Time template selector
|
// Run-Time to Compile-Time template selector
|
||||||
template <template <typename> class Comp, template <typename> class... Ops>
|
template <template <typename> class Comp, template <typename> class... Ops>
|
||||||
struct cmRt2CtSelector
|
struct cmRt2CtSelector
|
||||||
@@ -716,13 +722,7 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
|
|||||||
this->matchKeys(*args.next, keyVERSION_LESS,
|
this->matchKeys(*args.next, keyVERSION_LESS,
|
||||||
keyVERSION_LESS_EQUAL, keyVERSION_GREATER,
|
keyVERSION_LESS_EQUAL, keyVERSION_GREATER,
|
||||||
keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) {
|
keyVERSION_GREATER_EQUAL, keyVERSION_EQUAL))) {
|
||||||
|
const auto op = MATCH2CMPOP[matchNo - 1];
|
||||||
const cmSystemTools::CompareOp xlat[5] = {
|
|
||||||
cmSystemTools::OP_LESS, cmSystemTools::OP_LESS_EQUAL,
|
|
||||||
cmSystemTools::OP_GREATER, cmSystemTools::OP_GREATER_EQUAL,
|
|
||||||
cmSystemTools::OP_EQUAL
|
|
||||||
};
|
|
||||||
const auto op = xlat[matchNo - 1];
|
|
||||||
const cmProp lhs = this->GetVariableOrString(*args.current);
|
const cmProp lhs = this->GetVariableOrString(*args.current);
|
||||||
const cmProp rhs = this->GetVariableOrString(*args.nextnext);
|
const cmProp rhs = this->GetVariableOrString(*args.nextnext);
|
||||||
const auto result =
|
const auto result =
|
||||||
|
|||||||
Reference in New Issue
Block a user