<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Command `if(a MATCHES ...)` has the same flaw:
    `if(<variable|string> MATCHES regex)`:<br>
    
    ..<br>
    set(MYSTRING "B")<br>
    set(A "MYSTRING")<br>
    if("${A}" MATCHES "^MYSTRING$")<br>
      # do *not* go here even A is MYSTRING (use *variable* MYSTRING)<br>
    endif()<br></div></blockquote><div> <br>This should work without dereferencing A, i.e.:<br></div><br><span style="font-family:courier new,monospace">if(A MATCHES "^MYSTRING$")<br></span></div><div class="gmail_quote">

<span style="font-family:courier new,monospace">  # Bingo<br></span></div><div class="gmail_quote"><span style="font-family:courier new,monospace">endif()</span><br></div></div></div>