summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-17 14:53:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-17 14:53:46 (GMT)
commitfa4a499238502dead01c482a168eb52b6599dc22 (patch)
treebf5979cea353f228c43b993194e22555928afaab /Help
parentc7ebec770f19faa7b16df280a1f4804fa98b1011 (diff)
parent1bb17692359d675eee12996c43446fa9c9fe5175 (diff)
downloadCMake-fa4a499238502dead01c482a168eb52b6599dc22.zip
CMake-fa4a499238502dead01c482a168eb52b6599dc22.tar.gz
CMake-fa4a499238502dead01c482a168eb52b6599dc22.tar.bz2
Merge topic 'cmake-language-exit-code'
1bb1769235 cmake_language: Add EXIT subcommand 4f160f7906 cmakemain: Return the SCRIPT_MODE exit code if it was set b62dcbf5d2 cmMakefile: check cmake script mode exit code after command 3d9d504646 cmMakefile: Store the exit code from cmExecutionStatus to cmake instance 9f6c937408 Source/cmake.h: Add ScriptModeExitCode for proper storing exit code 1082b9cb9a cmExecutionStatus: Add ability to set optional custom exit code Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: Leonid Pospelov <pospelovlm@yandex.ru> Acked-by: NoMaY (a user of Renesas Rulz Japanese Forum) <nomay-jp@outlook.com> Merge-request: !8228
Diffstat (limited to 'Help')
-rw-r--r--Help/command/cmake_language.rst23
-rw-r--r--Help/release/dev/cmake-language-exit.rst5
2 files changed, 28 insertions, 0 deletions
diff --git a/Help/command/cmake_language.rst b/Help/command/cmake_language.rst
index 4b64eb6..45ac569 100644
--- a/Help/command/cmake_language.rst
+++ b/Help/command/cmake_language.rst
@@ -15,6 +15,7 @@ Synopsis
cmake_language(`DEFER`_ <options>... CALL <command> [<arg>...])
cmake_language(`SET_DEPENDENCY_PROVIDER`_ <command> SUPPORTED_METHODS <methods>...)
cmake_language(`GET_MESSAGE_LOG_LEVEL`_ <out-var>)
+ cmake_language(`EXIT`_ <exit-code>)
Introduction
^^^^^^^^^^^^
@@ -506,3 +507,25 @@ Getting current message log level
If both the command line option and the variable are set, the command line
option takes precedence. If neither are set, the default logging level
is returned.
+
+Terminating Scripts
+^^^^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.29
+
+.. _EXIT:
+.. _exit-code:
+
+.. code-block:: cmake
+
+.. signature::
+ cmake_language(EXIT <exit-code>)
+
+ Terminate the current :option:`cmake -P` script and exit with ``<exit-code>``.
+
+ This command works only in :ref:`script mode <Script Processing Mode>`.
+
+ The ``<exit-code>`` should be non-negative.
+ If ``<exit-code>`` is negative then the behavior
+ is unspecified (e.g., on Windows the error code -1
+ becomes ``0xffffffff``, and on Linux it becomes ``255``).
diff --git a/Help/release/dev/cmake-language-exit.rst b/Help/release/dev/cmake-language-exit.rst
new file mode 100644
index 0000000..42e8ae2
--- /dev/null
+++ b/Help/release/dev/cmake-language-exit.rst
@@ -0,0 +1,5 @@
+cmake-language-exit
+-------------------
+
+* The :command:`cmake_language()` command gained a new ``EXIT``
+ sub-command to exit scripts with a specified exit code.