summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-25 13:09:28 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-25 13:09:37 (GMT)
commit40628b2519ae1553a33f701cf46ee8fbbd013b85 (patch)
tree7355225a83e125ce7b650967b6798b4ebbf8739a /Help
parent24b6e4830d9027e63db7dfafa500aaeb652d3a4c (diff)
parenta6982cff0d3910723ad4fd40b9c63cf77c872d30 (diff)
downloadCMake-40628b2519ae1553a33f701cf46ee8fbbd013b85.zip
CMake-40628b2519ae1553a33f701cf46ee8fbbd013b85.tar.gz
CMake-40628b2519ae1553a33f701cf46ee8fbbd013b85.tar.bz2
Merge topic 'max-recursion-depth'
a6982cff0d cmMakefile: Impose maximum recursion limit Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Juraj Oršulić <juraj.orsulic@fer.hr> Merge-request: !2746
Diffstat (limited to 'Help')
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/max-recursion-depth.rst6
-rw-r--r--Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst33
3 files changed, 40 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index bd6a58f..de4ce3d 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -190,6 +190,7 @@ Variables that Change Behavior
/variable/CMAKE_LIBRARY_PATH
/variable/CMAKE_LINK_DIRECTORIES_BEFORE
/variable/CMAKE_MFC_FLAG
+ /variable/CMAKE_MAXIMUM_RECURSION_DEPTH
/variable/CMAKE_MODULE_PATH
/variable/CMAKE_NOT_USING_CONFIG_FLAGS
/variable/CMAKE_POLICY_DEFAULT_CMPNNNN
diff --git a/Help/release/dev/max-recursion-depth.rst b/Help/release/dev/max-recursion-depth.rst
new file mode 100644
index 0000000..3d9c781
--- /dev/null
+++ b/Help/release/dev/max-recursion-depth.rst
@@ -0,0 +1,6 @@
+max-recursion-depth
+-------------------
+
+* CMake now imposes a maximum recursion limit to prevent a stack overflow on
+ scripts that recurse infinitely. The limit can be adjusted at runtime with
+ :variable:`CMAKE_MAXIMUM_RECURSION_DEPTH`.
diff --git a/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst
new file mode 100644
index 0000000..7110b16
--- /dev/null
+++ b/Help/variable/CMAKE_MAXIMUM_RECURSION_DEPTH.rst
@@ -0,0 +1,33 @@
+CMAKE_MAXIMUM_RECURSION_DEPTH
+-----------------------------
+
+Maximum recursion depth for CMake scripts. It is intended to be set on the
+command line with ``-DCMAKE_MAXIMUM_RECURSION_DEPTH=<x>``, or within
+``CMakeLists.txt`` by projects that require a large recursion depth. Projects
+that set this variable should provide the user with a way to override it. For
+example:
+
+.. code-block:: cmake
+
+ # About to perform deeply recursive actions
+ if(NOT CMAKE_MAXIMUM_RECURSION_DEPTH)
+ set(CMAKE_MAXIMUM_RECURSION_DEPTH 2000)
+ endif()
+
+If it is not set, or is set to a non-integer value, a sensible default limit is
+used. If the recursion limit is reached, the script terminates immediately with
+a fatal error.
+
+Calling any of the following commands increases the recursion depth:
+
+* :command:`include`
+* :command:`find_package`
+* :command:`add_subdirectory`
+* :command:`try_compile`
+* :command:`ctest_read_custom_files`
+* :command:`ctest_run_script` (unless ``NEW_PROCESS`` is specified)
+* User-defined :command:`function`'s and :command:`macro`'s (note that
+ :command:`function` and :command:`macro` themselves don't increase recursion
+ depth)
+* Reading or writing variables that are being watched by a
+ :command:`variable_watch`