summaryrefslogtreecommitdiff
path: root/Help/command/add_executable.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Help/command/add_executable.rst')
-rw-r--r--Help/command/add_executable.rst24
1 files changed, 13 insertions, 11 deletions
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst
index c088796e4..0a7d7e151 100644
--- a/Help/command/add_executable.rst
+++ b/Help/command/add_executable.rst
@@ -3,18 +3,19 @@ add_executable
Add an executable to the project using the specified source files.
-::
+.. code-block:: cmake
add_executable(<name> [WIN32] [MACOSX_BUNDLE]
[EXCLUDE_FROM_ALL]
- source1 [source2 ...])
+ [source1] [source2 ...])
Adds an executable target called ``<name>`` to be built from the source
-files listed in the command invocation. The ``<name>`` corresponds to the
-logical target name and must be globally unique within a project. The
-actual file name of the executable built is constructed based on
-conventions of the native platform (such as ``<name>.exe`` or just
-``<name>``).
+files listed in the command invocation. (The source files can be omitted
+here if they are added later using :command:`target_sources`.) The
+``<name>`` corresponds to the logical target name and must be globally
+unique within a project. The actual file name of the executable built is
+constructed based on conventions of the native platform (such as
+``<name>.exe`` or just ``<name>``).
By default the executable file will be created in the build tree
directory corresponding to the source tree directory in which the
@@ -46,7 +47,7 @@ within IDE.
--------------------------------------------------------------------------
-::
+.. code-block:: cmake
add_executable(<name> IMPORTED [GLOBAL])
@@ -66,15 +67,16 @@ properties for more information.
--------------------------------------------------------------------------
-::
+.. code-block:: cmake
add_executable(<name> ALIAS <target>)
Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can
be used to refer to ``<target>`` in subsequent commands. The ``<name>``
does not appear in the generated buildsystem as a make target. The
-``<target>`` may not be an :ref:`Imported Target <Imported Targets>` or an
-``ALIAS``. ``ALIAS`` targets can be used as targets to read properties
+``<target>`` may not be a non-``GLOBAL``
+:ref:`Imported Target <Imported Targets>` or an ``ALIAS``.
+``ALIAS`` targets can be used as targets to read properties
from, executables for custom commands and custom targets. They can also be
tested for existence with the regular :command:`if(TARGET)` subcommand.
The ``<name>`` may not be used to modify properties of ``<target>``, that