Ok interesting, it is working for me too. I guess my reproducible use case
was invalid.

(BTW, I'm running through cmake-gui on Windows 7 x64 using CMake version
2.8.5)

My use case was a simplified version of the real code. FUBARTEST is actually
a cache variable defined by the root CMakeLists.txt file. In my real test
case, my STREQUAL statement is failing to execute the conditional code when
I do this:

if( NEMO_TARGET STREQUAL "NSPR" )

However if I do this, it works:

if( "${NEMO_TARGET}" STREQUAL "NSPR" )

I don't know why both would behave differently. Just to rule out the cache
variable being the issue, I tried this (I attempted to make the SET() call
override the originally defined cache variable. I did not actually remove
the variable from cache):

set( NEMO_TARGET "NSPR" )
if( NEMO_TARGET STREQUAL "NSPR" )

Of course, this statement did not result in the enclosed message() being
executed.

I have tried creating a small test case to reproduce this issue but so far I
have been unsuccessful. I'll try clearing my cache to rule out any issues
there. In the meantime if you have any suspicions or have run into this
before, please give me some ideas on how to solve this :)

Thanks.

---------
Robert Dailey


On Thu, Oct 6, 2011 at 1:31 PM, Eric Noulard <eric.noul...@gmail.com> wrote:

> 2011/10/6 Robert Dailey <rcdai...@gmail.com>:
> > According to the CMake documentation, the `STREQUAL` comparison is
> allowed
> > to take either a VARIABLE or a STRING as either parameter. So, in this
> > example below, the message does NOT print, which is broken:
> >     set( FUBARTEST "OK" )
> >     if( FUBARTEST STREQUAL "OK" )
> >     message( "It Worked" )
> >     endif()
> > Any reason why this isn't working as documented?
>
> Don't know but it works just fine for on Linux + CMake 2.8.6
> which cmake version are you using?
>
> Could you try running
> cmake --trace --debug-output -P  fubartest.cmake
>
> and tell us waht's printed out?
>
>
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
--
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://www.cmake.org/mailman/listinfo/cmake

Reply via email to