[CMake] STREQUAL not functioning?

Robert Dailey rcdailey at gmail.com
Thu Oct 6 14:51:33 EDT 2011


Well there you go, deleting the cache & reconfiguring fixed it. That was
weird.

Thanks for the help!

---------
Robert Dailey


On Thu, Oct 6, 2011 at 1:50 PM, Robert Dailey <rcdailey at gmail.com> wrote:

> 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.noulard at gmail.com>wrote:
>
>> 2011/10/6 Robert Dailey <rcdailey at 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111006/7c2336c5/attachment-0001.htm>


More information about the CMake mailing list