This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  b734a04164dcd4eb37246b4b0d52e22996d8ef43 (commit)
       via  c6f08a2125d98a22ae08f6ac8f39095bda09b490 (commit)
      from  947b02e2e0d0a7d9c8155b50ac79b56818f4b6f6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b734a04164dcd4eb37246b4b0d52e22996d8ef43
commit b734a04164dcd4eb37246b4b0d52e22996d8ef43
Merge: 947b02e c6f08a2
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Mon Oct 7 14:47:46 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Oct 7 10:47:54 2019 -0400

    Merge topic 'doc_custom_commands_crosscompile'
    
    c6f08a2125 Help: Clarify how target names are handled in custom 
commands/targets
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3891


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c6f08a2125d98a22ae08f6ac8f39095bda09b490
commit c6f08a2125d98a22ae08f6ac8f39095bda09b490
Author:     Craig Scott <craig.sc...@crascit.com>
AuthorDate: Sat Oct 5 23:11:14 2019 +1000
Commit:     Craig Scott <craig.sc...@crascit.com>
CommitDate: Sat Oct 5 23:11:14 2019 +1000

    Help: Clarify how target names are handled in custom commands/targets
    
    Fixes: #19771

diff --git a/Help/command/add_custom_command.rst 
b/Help/command/add_custom_command.rst
index ab2a023..df7cc4e 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -79,25 +79,33 @@ The options are:
   will be ignored.
 
   If ``COMMAND`` specifies an executable target name (created by the
-  :command:`add_executable` command) it will automatically be replaced
-  by the location of the executable created at build time. If set, the
-  :prop_tgt:`CROSSCOMPILING_EMULATOR` executable target property will
-  also be prepended to the command to allow the executable to run on
-  the host.
-  (Use the ``TARGET_FILE``
-  :manual:`generator expression <cmake-generator-expressions(7)>` to
-  reference an executable later in the command line.)
-  Additionally a target-level dependency will be added so that the
-  executable target will be built before any target using this custom
-  command.  However this does NOT add a file-level dependency that
-  would cause the custom command to re-run whenever the executable is
-  recompiled.
+  :command:`add_executable` command), it will automatically be replaced
+  by the location of the executable created at build time if either of
+  the following is true:
+
+  * The target is not being cross-compiled (i.e. the
+    :variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
+  * The target is being cross-compiled and an emulator is provided (i.e.
+    its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
+    In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
+    prepended to the command before the location of the target executable.
+
+  If neither of the above conditions are met, it is assumed that the
+  command name is a program to be found on the ``PATH`` at build time.
 
   Arguments to ``COMMAND`` may use
   :manual:`generator expressions <cmake-generator-expressions(7)>`.
-  References to target names in generator expressions imply target-level
-  dependencies, but NOT file-level dependencies.  List target names with
-  the ``DEPENDS`` option to add file-level dependencies.
+  Use the ``TARGET_FILE`` generator expression to refer to the location of
+  a target later in the command line (i.e. as a command argument rather
+  than as the command to execute).
+
+  Whenever a target is used as a command to execute or is mentioned in a
+  generator expression as a command argument, a target-level dependency
+  will be added automatically so that the mentioned target will be built
+  before any target using this custom command.  However this does NOT add
+  a file-level dependency that would cause the custom command to re-run
+  whenever the executable is recompiled.  List target names with
+  the ``DEPENDS`` option to add such file-level dependencies.
 
 ``COMMENT``
   Display the given message before the commands are executed at
diff --git a/Help/command/add_custom_target.rst 
b/Help/command/add_custom_target.rst
index e74960c..2d5f5f0 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -58,18 +58,30 @@ The options are:
   a ``COMMAND`` to launch it.)
 
   If ``COMMAND`` specifies an executable target name (created by the
-  :command:`add_executable` command) it will automatically be replaced
-  by the location of the executable created at build time. If set, the
-  :prop_tgt:`CROSSCOMPILING_EMULATOR` executable target property will
-  also be prepended to the command to allow the executable to run on
-  the host.
-  Additionally a target-level dependency will be added so that the
-  executable target will be built before this custom target.
+  :command:`add_executable` command), it will automatically be replaced
+  by the location of the executable created at build time if either of
+  the following is true:
+
+  * The target is not being cross-compiled (i.e. the
+    :variable:`CMAKE_CROSSCOMPILING` variable is not set to true).
+  * The target is being cross-compiled and an emulator is provided (i.e.
+    its :prop_tgt:`CROSSCOMPILING_EMULATOR` target property is set).
+    In this case, the contents of :prop_tgt:`CROSSCOMPILING_EMULATOR` will be
+    prepended to the command before the location of the target executable.
+
+  If neither of the above conditions are met, it is assumed that the
+  command name is a program to be found on the ``PATH`` at build time.
 
   Arguments to ``COMMAND`` may use
   :manual:`generator expressions <cmake-generator-expressions(7)>`.
-  References to target names in generator expressions imply target-level
-  dependencies.
+  Use the ``TARGET_FILE`` generator expression to refer to the location of
+  a target later in the command line (i.e. as a command argument rather
+  than as the command to execute).
+
+  Whenever a target is used as a command to execute or is mentioned in a
+  generator expression as a command argument, a target-level dependency
+  will be added automatically so that the mentioned target will be built
+  before this custom target.
 
   The command and arguments are optional and if not specified an empty
   target will be created.

-----------------------------------------------------------------------

Summary of changes:
 Help/command/add_custom_command.rst | 40 ++++++++++++++++++++++---------------
 Help/command/add_custom_target.rst  | 30 +++++++++++++++++++---------
 2 files changed, 45 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to