[CMake] Re: CMake and Lua

Philip Lowman philip at yhbt.com
Fri Feb 29 09:55:11 EST 2008


On Fri, Feb 29, 2008 at 8:57 AM, Rodolfo Schulz de Lima <rodolfo at rodsoft.org>
wrote:

> Bill Hoffman escreveu:
> > So what exactly about the CMake language gives you this feel?
>
> Hi, let me just add my opinion on this one. I really think that in a if
> clause, having to repeat the condition in the else, elseif and endif is
> a little too much verbose for my taste. The following snippet
> illustrates this issue
>
> IF(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
>     set(outofbuild true)
> ELSE(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
>     set(outofbuild false)
> endif(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}
>
> I know that we can disable this *feature*, but it isn't default. I know
> you did this to help programmers know which 'if' an 'endif' is related,
> but this kind of thing is normally done with comments. And in my example
> above since each branch has one line, the verbosity is unnecessary.



I wholeheartedly agree.  I don't think people realize how unreadable,
unmaintainable, and confusing this "feature" really is.

It's unreadable because you have to read the same crap over and over again
(occupying at least 3 lines, sometimes 6 depending on how complex the
conditional is).

It's unmaintainable because every time you make the slightest modification
to your original IF() statement you have to modify both ELSE() and ENDIF().

It's confusing because most people using CMake are programmers and most
modern programming languages have no such requirement in their conditionals,
function declarations, etc.

Can you imagine if C had been written so you had to do this:

if(x == 6 && y <= 15)
{
   // do something
}
else if(x ==6 && y > 15)
{
   // do something else
}
else(x==6 && y <= 15)
{
   // the programmer is extremely confused here... It looks like another
ELSEIF() but it's not.
}
endif(x==6 && y <= 15)



Will Kitware consider making CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS default to on
starting with 2.6.0 and doing away with this annoying construct?



-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080229/52c36c29/attachment.htm


More information about the CMake mailing list