On Saturday 23 March 2013, David Cole wrote:
> Wow, could be a variable on the right, too. So my previous example was
> still not 100% safe.
> 
> Maybe this construct is 100% safe:
> 
>     set(x "${some_var_that_may_eval_to_another_var_name}")
>     set(y "some string constant that may also accidentally be a var")
>     if(x STREQUAL y)
> 
> You can see why the "x${var}" STREQUAL "xSomeString" approach is
> appealing after a discussion like this. 

Hmm, actually, to me, no.
Now you have ugly code and as Brad noted, you can still construct cases where 
it breaks.
That's why I came up with that quick, safe and not-really-dirty patch.

Having said that, I've never been hit by that problem, or at least I'm not 
aware of it.

Alex
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to