[CMake] elseif request
Brandon J. Van Every
bvanevery at gmail.com
Sat Sep 16 15:11:16 EDT 2006
Alan W. Irwin wrote:
> I would like to request an elseif extension to the cmake language.
You can make a feature request with http://www.cmake.org/Bug/
>
> if(cond1)
> block of statements
> elseif(cond2)
> block of statements
> elseif(cond3)
> block of statements
>
> ...
>
> elseif(condn)
> block of statements
> else(cond1)
> block of statements
> endif(cond1)
>
>
> My apologies in advance if I have missed elseif or equivalent in the
> documentation, but I have searched hard for it and cannot find it.
> This is
> such an obvious extension that I assume it is on some CMake ToDo list
> somewhere, and/or wish-list bug entries.
The bug tracker, which contains the feature requests, is also searchable.
I do not agree that it's an obvious extension to the CMake language. If
elseif is introduced as you describe above, then conditions 2..n have no
matching condition. It is the CMake language style to force the user to
bracket their conditional with matching conditions. Personally I think
this is a good design choice, especially as conditionals are nested
deeper and deeper, as it does prevent some user errors.
Cheers,
Brandon Van Every
More information about the CMake
mailing list