فهرست منبع

Merge topic 'fix-compare'

4bc1486cd3 cmConditionEvaluator: Avoid comparing pointers

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5189
Kyle Edwards 5 سال پیش
والد
کامیت
11a0c04472
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      Source/cmConditionEvaluator.cxx

+ 4 - 3
Source/cmConditionEvaluator.cxx

@@ -535,9 +535,10 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
       this->IncrementArguments(newArgs, argP1, argP2);
       this->IncrementArguments(newArgs, argP1, argP2);
       if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
       if (argP1 != newArgs.end() && argP2 != newArgs.end() &&
           IsKeyword(keyMATCHES, *argP1)) {
           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.
           // The string to match is owned by our match result variables.
           // Move it to our own buffer before clearing them.
           // Move it to our own buffer before clearing them.
           def_buf = def;
           def_buf = def;