[CMake] return and break commands

Josef Karthauser joe.karthauser at geomerics.com
Fri Jan 25 03:11:22 EST 2008


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