[CMake] Fwd: [CMake 0012398]: "IF" infamous <variable/string> functionality fails to work with macro arguments

Glenn Coombs glenn.coombs at gmail.com
Tue Aug 16 18:07:37 EDT 2011


On 15 August 2011 20:23, Albert Meltzer <bulsara at gmail.com> wrote:

> Maybe the esteemed colleagues would suggest another good and reliable way
> to handle situations such as this:
>
> IF (lang STREQUAL "perl") ...
> ELSEIF(lang STREQUAL "python") ...
> ELSEIF(....)
> ...
> ENDIF ()
>
> without having to SET(perl perl) (and all the other cases in this switch)
> myself (just in case), but still being afraid that somebody, somewhere else,
> would SET(perl 5.10.0), and without resorting to IF (lang MATCHES "^perl$")?
>

Maybe I'm missing something obvious here but wouldn't the following code
work okay:

if ("${lang}" STREQUAL "perl") ...
elseif ("${lang}" STREQUAL "python") ...
elseif (....)
...
endif ()

--
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110816/006914eb/attachment.htm>


More information about the CMake mailing list