Only the "special" strings cause the warning. Things like "Y" "y" "N" "n" "true" "0" "1" "on" "off" etc.<br><br>This is correct behavior and what the policy is about. It's not about strings in general, but about the specific strings that are used for boolean constant aliases...<br>
<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 12, 2012 at 10:30 AM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl" target="_blank">loose@astron.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I noticed that, when using a string expression in an IF() statement -- which you obviously shouldn't do, but I was just playing around -- CMake sometimes generates a developer warning CMP0012. Whether it does that or not depends on the string your using.<br>
<br>
The following file<br>
<br>
$ cat string_in_conditional.cmake<br>
if("x")<br>
message(STATUS "\"x\" evaluate to TRUE")<br>
else()<br>
message(STATUS "\"x\" evaluate to FALSE")<br>
endif()<br>
if("y")<br>
message(STATUS "\"y\" evaluate to TRUE")<br>
else()<br>
message(STATUS "\"y\" evaluate to FALSE")<br>
endif()<br>
<br>
produces the following output when run with cmake 2.8.9<br>
<br>
$ cmake -P string_in_conditional.cmake<br>
-- "x" evaluate to FALSE<br>
CMake Warning (dev) at string_in_conditional.cmake:6 (if):<br>
given arguments:<br>
<br>
"y"<br>
<br>
An argument named "y" appears in a conditional statement. Policy CMP0012<br>
is not set: if() recognizes numbers and boolean constants. Run "cmake<br>
--help-policy CMP0012" for policy details. Use the cmake_policy command to<br>
set the policy and suppress this warning.<br>
This warning is for project developers. Use -Wno-dev to suppress it.<br>
<br>
-- "y" evaluate to FALSE<br>
<br>
I.e., it doesn't produce a warning when using "x" in an if() statement, but it does when using "y".<br>
<br>
<br>
Best regards,<br>
Marcel Loose.<br>
<br>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>
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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>