return.rst 808 B

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