Hi

if(expression)
 ...
endif(expression2)

Makes an error since the expressions didn't match

I think this is the case with "else" as well.

However, i'm uncertain how to write it when you use elseif, maybe it still 
needs to match with the expression in the IF thing


The reasoning behind this, AFAIK, is to provide checking for errors in 
your scripts.

Feel free to leave those out from else and endif if you trust yourself : )

-mika



From:   Michael Wild <them...@gmail.com>
To:     cmake@cmake.org
Date:   02.05.2011 07:56
Subject:        Re: [CMake] If syntax
Sent by:        cmake-boun...@cmake.org



On 05/01/2011 10:30 PM, David Doria wrote:
> According to this:
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:if
> 
> the syntax is:
> 
>   if(expression)
>     ...
>   elseif(expression2)
>     ...
>   else(expression)
>     ...
>   endif(expression)
> 
> I was recently made aware that:
> 
> 
>   if(expression)
>     ...
>   elseif(expression2)
>     ...
>   else()
>     ...
>   endif()
> 
> should also work. Should the documentation be updated to reflect this
> possibility? Or are they different in some way?
> 
> David

>From the documentation of the IF() command:

> Note that the expression in the else and endif clause is optional.

Michael
_______________________________________________
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

_______________________________________________
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

Reply via email to