1CMAKE_MAXIMUM_RECURSION_DEPTH
2-----------------------------
3
4.. versionadded:: 3.14
5
6Maximum recursion depth for CMake scripts. It is intended to be set on the
7command line with ``-DCMAKE_MAXIMUM_RECURSION_DEPTH=<x>``, or within
8``CMakeLists.txt`` by projects that require a large recursion depth. Projects
9that set this variable should provide the user with a way to override it. For
10example:
11
12.. code-block:: cmake
13
14  # About to perform deeply recursive actions
15  if(NOT CMAKE_MAXIMUM_RECURSION_DEPTH)
16    set(CMAKE_MAXIMUM_RECURSION_DEPTH 2000)
17  endif()
18
19If it is not set, or is set to a non-integer value, a sensible default limit is
20used. If the recursion limit is reached, the script terminates immediately with
21a fatal error.
22
23Calling any of the following commands increases the recursion depth:
24
25* :command:`include`
26* :command:`find_package`
27* :command:`add_subdirectory`
28* :command:`try_compile`
29* :command:`ctest_read_custom_files`
30* :command:`ctest_run_script` (unless ``NEW_PROCESS`` is specified)
31* User-defined :command:`function`'s and :command:`macro`'s (note that
32  :command:`function` and :command:`macro` themselves don't increase recursion
33  depth)
34* Reading or writing variables that are being watched by a
35  :command:`variable_watch`
36