diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-07 16:17:32 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-07 16:17:39 (GMT) |
commit | 11a0c044720609098c4d8b248835839f660a68bf (patch) | |
tree | 1aaa2fd880348a52ad7cef780d23de29f74dd399 /Source | |
parent | 726fe807597e2a19fb20c73376bf4dc39e1c6687 (diff) | |
parent | 4bc1486cd3bfe4eba9c0fb169a87f431596a7959 (diff) | |
download | CMake-11a0c044720609098c4d8b248835839f660a68bf.zip CMake-11a0c044720609098c4d8b248835839f660a68bf.tar.gz CMake-11a0c044720609098c4d8b248835839f660a68bf.tar.bz2 |
Merge topic 'fix-compare'
4bc1486cd3 cmConditionEvaluator: Avoid comparing pointers
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5189
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index daa9f4c..8021b49 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -535,9 +535,10 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, this->IncrementArguments(newArgs, argP1, argP2); if (argP1 != newArgs.end() && argP2 != newArgs.end() && IsKeyword(keyMATCHES, *argP1)) { - def = this->GetVariableOrString(*arg); - if (def != arg->c_str() // yes, we compare the pointer value - && cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) { + def = this->GetDefinitionIfUnquoted(*arg); + if (!def) { + def = arg->c_str(); + } else if (cmHasLiteralPrefix(arg->GetValue(), "CMAKE_MATCH_")) { // The string to match is owned by our match result variables. // Move it to our own buffer before clearing them. def_buf = def; |