mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-09 10:00:12 -05:00
cmake_command: Add command to INVOKE other commands by name
Fixes: #18392
This commit is contained in:
40
Help/command/cmake_command.rst
Normal file
40
Help/command/cmake_command.rst
Normal file
@@ -0,0 +1,40 @@
|
||||
cmake_command
|
||||
-------------
|
||||
|
||||
Call meta-operations on CMake commands.
|
||||
|
||||
Synopsis
|
||||
^^^^^^^^
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
cmake_command(`INVOKE`_ <command> [<args>...])
|
||||
|
||||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This command will call meta-operations on built-in CMake commands or
|
||||
those created via the :command:`macro` or :command:`function` commands.
|
||||
|
||||
Invoking
|
||||
^^^^^^^^
|
||||
|
||||
.. _INVOKE:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_command(INVOKE <command> [<args>...])
|
||||
|
||||
Invokes the named ``<command>`` with the given arguments (if any).
|
||||
For example, the code:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(message_command "message")
|
||||
cmake_command(INVOKE ${message_command} STATUS "Hello World!")
|
||||
|
||||
is equivalent to
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
message(STATUS "Hello World!")
|
||||
@@ -44,11 +44,15 @@ can be invoked through any of
|
||||
foo()
|
||||
Foo()
|
||||
FOO()
|
||||
cmake_command(INVOKE foo)
|
||||
|
||||
and so on. However, it is strongly recommended to stay with the
|
||||
case chosen in the function definition. Typically functions use
|
||||
all-lowercase names.
|
||||
|
||||
The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
|
||||
function.
|
||||
|
||||
Arguments
|
||||
^^^^^^^^^
|
||||
|
||||
|
||||
@@ -42,11 +42,15 @@ can be invoked through any of
|
||||
foo()
|
||||
Foo()
|
||||
FOO()
|
||||
cmake_command(INVOKE foo)
|
||||
|
||||
and so on. However, it is strongly recommended to stay with the
|
||||
case chosen in the macro definition. Typically macros use
|
||||
all-lowercase names.
|
||||
|
||||
The :command:`cmake_command(INVOKE ...)` command can also be used to invoke the
|
||||
macro.
|
||||
|
||||
Arguments
|
||||
^^^^^^^^^
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ These commands are always available.
|
||||
:maxdepth: 1
|
||||
|
||||
/command/break
|
||||
/command/cmake_command
|
||||
/command/cmake_host_system_information
|
||||
/command/cmake_minimum_required
|
||||
/command/cmake_parse_arguments
|
||||
|
||||
6
Help/release/dev/cmake_command-command.rst
Normal file
6
Help/release/dev/cmake_command-command.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
cmake_command
|
||||
-------------
|
||||
|
||||
* The :command:`cmake_command()` command was added for meta-operations on
|
||||
scripted or built-in commands, starting with a mode to ``INVOKE`` other
|
||||
commands.
|
||||
Reference in New Issue
Block a user