MantisBT - CMake
View Issue Details
0003612CMakeCMakepublic2006-08-15 11:402008-01-23 12:34
Allen Winter 
Ken Martin 
lowfeaturealways
closedfixed 
 
 
0003612: Feature for graceful exiting
I wish there was a way to exit a cmake script gracefully without raising a FATAL_ERROR.

Something like message(EXIT, "optional message")
that doesn't scare the user with a stack trace or indicate any errors at all.

Or maybe Exit(code)? where you exit with a code?
No tags attached.
Issue History
2007-08-21 16:27Alex NeundorfNote Added: 0008567
2007-11-01 06:07Alex NeundorfNote Added: 0009600
2007-11-01 07:26Josef KarthauserNote Added: 0009601
2008-01-03 09:13Bill HoffmanAssigned ToBill Hoffman => Ken Martin
2008-01-07 17:30Alex NeundorfNote Added: 0010092
2008-01-23 12:34Ken MartinStatusassigned => closed
2008-01-23 12:34Ken MartinNote Added: 0010237
2008-01-23 12:34Ken MartinResolutionopen => fixed

Notes
(0008567)
Alex Neundorf   
2007-08-21 16:27   
What's the use case ?
(0009600)
Alex Neundorf   
2007-11-01 06:07   
Allen, what's the use case ?

Alex
(0009601)
Josef Karthauser   
2007-11-01 07:26   
It is sometimes necessary for cmake to test things and terminate if the conditions aren't met.

For instance, when adding files to a project, it is possible to write macros so that a file is automatically created from a template file during the cmake process. It may be an error if the template for a given file type isn't found, which would warrant a termination with an error message. I've found that raising a MESSAGE(FATAL_ERROR "some error message") doesn't always terminate, from deep within a macro.
(0010092)
Alex Neundorf   
2008-01-07 17:30   
Some ideas:

how about BREAK ?
in a loop: terminate loop

in a macro/function: "return" from that macro/function

on file level: stop processing this file

Alex
(0010237)
Ken Martin   
2008-01-23 12:34   
return and break both implemented. return effectively stops processing of the CMakeLists file at that point. So...

message ("unable to find foo")
return()

should help address this issue