[CMake] return and break commands

Ken Martin ken.martin at kitware.com
Fri Jan 25 10:17:30 EST 2008


It would not be that hard to port it, but...I'm pretty sure we are done with
the 2.4 branch. 2.4.8 is probably the last of the 2.4 releases. We are (and
have been) gearing up for the 2.6 release which I hope we will get into beta
in a few weeks. 

- Ken

Ken Martin PhD 
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971 

> -----Original Message-----
> From: Josef Karthauser [mailto:joe.karthauser at geomerics.com]
> Sent: Friday, January 25, 2008 3:11 AM
> To: Ken Martin; cmake at cmake.org
> Subject: RE: [CMake] return and break commands
> 
> How easy would it be to port this functionality to 2.4.x?
> 
> Joe
> 
> > -----Original Message-----
> > From: cmake-bounces+joe.karthauser=geomerics.com at cmake.org
> > [mailto:cmake-bounces+joe.karthauser=geomerics.com at cmake.org] On
> Behalf
> > Of Ken Martin
> > Sent: 23 January 2008 15:56
> > To: cmake at cmake.org
> > Subject: [CMake] return and break commands
> >
> > I just checked into CVS return and break commands for CMake. They work
> > pretty much how you would expect the usual C return and break commands
> > to
> > work.  A couple quick notes:
> >
> > 1) Macros are like cpp macros (not functions), a return in a macro is
> > no
> > different than an inline return.
> >
> > 2) return from a directory/file (as opposed to a function) will stop
> > processing that CMakeLists file and return control to the parent
> > (whoever
> > called add_subdirectory) if there is a parent.
> >
> > 3) break works on foreach and while loops. A break inside an if/else
> > clause
> > breaks you out of the enclosing foreach or while loop just like C. The
> > same
> > idea holds for return statements inside an if/else/foreach/while, they
> > return you out of the current function or directory.
> >
> > 4) return invoked from an included file should stop processing the
> > current
> > file and take you back to the point of the include command. (forgot to
> > add a
> > test for this one, but really, what are the odds untested cases would
> > have a
> > bug in them :) *kidding*
> >
> > 5) basically these commands should do something fairly intuitive
> >
> > Give me a holler if there are problems.
> >
> > Ken
> >
> >
> > Ken Martin PhD
> > Kitware Inc.
> > 28 Corporate Drive
> > Clifton Park NY 12065
> > 518 371 3971
> >
> >
> >
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list