<div dir="ltr">As other has pointed out, this is caused by "if" interpreting its arguments as variables, if there is a variable with that name, and quoting the value don't help.<div><br></div><div>However, by embedded both argument in some extra text, you can make sure that the argument don't form a valid variable name. To apply this idea to your original example:</div>
<div><br></div><div><div>    set(a b)</div><div>    set(b c)</div><div>    if(">${a}<" STREQUAL ">b<" OR ">${a}<" STREQUAL ">c<")</div><div>      message("true")</div>
<div>    endif()</div></div><div><br></div><div>Another thing you can do to ensure that you don't fall into this trap is to use distinct variable names. I.e. use variable names that don't naturally occur in other situations in you CMakeLists:s. In your example "b" is used both as the name of a variable and as a value.</div>
<div><br></div><div>    -- Anders Lindgren</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 4, 2014 at 7:01 AM, Clark Wang <span dir="ltr"><<a href="mailto:dearvoid@gmail.com" target="_blank">dearvoid@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div></div>Hi,<br></div><div><br>I don't understand why the following code would not print "true" (tested with cmake-3.0):<br>
<br>  set(a b)<br>  set(b c)<br>  if(a STREQUAL b OR a STREQUAL c)<br>

    message("true")<br>
  endif()<br><br></div>From my understanding, no matter how magic the if command interprets its arguments, one of the expressions (a STREQUAL b) and (a STREQUAL c) must be true but I'm wrong. Anyone has a reasonable explanation?<br>



<br></div>Thanks.<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">-clark<br></font></span></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>