ec009d8c8c739c2e296fb4acc599ad017237520f
[platform/upstream/cmake.git] / Help / command / return.rst
1 return
2 ------
3
4 Return from a file, directory or function.
5
6 .. code-block:: cmake
7
8   return()
9
10 Returns from a file, directory or function.  When this command is
11 encountered in an included file (via :command:`include` or
12 :command:`find_package`), it causes processing of the current file to stop
13 and control is returned to the including file.  If it is encountered in a
14 file which is not included by another file, e.g.  a ``CMakeLists.txt``,
15 deferred calls scheduled by :command:`cmake_language(DEFER)` are invoked and
16 control is returned to the parent directory if there is one.  If return is
17 called in a function, control is returned to the caller of the function.
18
19 Note that a :command:`macro <macro>`, unlike a :command:`function <function>`,
20 is expanded in place and therefore cannot handle ``return()``.