[CMake] Case-insensitive string compare
David Cole
david.cole at kitware.com
Thu Jun 7 18:51:36 EDT 2012
You can't. You have to use TOLOWER and add an extra variable if you can't
mutate your existing variable value...
set( file "Makefile" )
string( TOLOWER "${file}" file_lower )
if( file_lower STREQUAL "makefile" )
...
On Thu, Jun 7, 2012 at 6:37 PM, Robert Dailey <rcdailey.lists at gmail.com>wrote:
> How can I perform a case-insensitive string comparison? I basically need
> to do this:
>
> set( file "Makefile" )
> if( file STREQUAL "makefile" )
> ....
> endif()
>
> The above condition should PASS, since I want to ignore case, but as of
> right now it seems STREQUAL is case-sensitive. I need to do this without
> mutating either operand (i.e. i can't use string( TOLOWER ) )
>
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120607/9ef0b64b/attachment.htm>
More information about the CMake
mailing list