[CMake] elseif request

Phillip Hellewell sshock at gmail.com
Mon Sep 18 23:42:01 EDT 2006


On 9/16/06, Filipe Sousa <filipe at ipb.pt> wrote:
>
>
> Not anymore. You can do
> SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1)
> IF(cond1)
> ELSE()
> ENDIF()


Wow, I never knew about that option.

I think adding adding an ELSEIF extension should not be a high priority,
since the same thing can be accomplished with existing constructs, and it
looks pretty decent and avoids indenting if that is your goal:

SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS 1)

IF(COND1)
   block of statements
ELSE()
IF(COND2)
   block of statements
ELSE()
IF(COND3)
   block of statements
ENDIF()
ENDIF()
ENDIF()

(Sure there are a lot of ENDIFs, but I can live with that.)

Phillip Hellewell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060918/69781ac6/attachment.htm


More information about the CMake mailing list