[CMake] elseif request

Brandon J. Van Every bvanevery at gmail.com
Sat Sep 16 19:45:59 EDT 2006


Alan W. Irwin wrote:
>
> On 2006-09-16 12:11-0700 Brandon J. Van Every wrote:
>> 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.
>
> Correct me if I am wrong, but here is what I assume you are proposing.
>
> if(cond1)
>   block of statements
> elseif(cond2)
>   block of statements
> endelseif(cond2)
> elseif(cond3)
>   block of statements
> endelseif(cond3)
>
> ...
>
> elseif(condn)
>   block of statements
> endelseif(condn)
> else(cond1)
>   block of statements
> endif(cond1)

I am not proposing it.  It is a solution more in the CMake style, but I 
am not proposing it.  There is no value add over simply using IF(COND) 
.. ELSE(COND) statements.  The user can indent the code any way he wants 
to avoid the "line crawl."


>
> To my mind those additional endelseif statements in this alternative
> proposal go against the whole reason for my first proposal which is to
> reduce the clutter that occurs in the equivalent existing form now 
> present
> in the language. 

The problem with your proposal is you want to reduce clutter at the 
expense of safety.  I don't personally think it's a good idea.  If 
safety concerns are addressed, you end up with exactly what is already 
available: IF(COND) .. ELSE(COND) and you're responsible for your 
indenting as you see fit.


Cheers,
Brandon Van Every



More information about the CMake mailing list