[Cmake-commits] CMake branch, next, updated. v3.4.3-2115-g991d04a

Brad King brad.king at kitware.com
Thu Jan 28 10:37:09 EST 2016


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, next has been updated
       via  991d04a395868caa7a33a0ddac9333641ec3295b (commit)
       via  d257d68138a00758910bbca3dd77dcfcc04e65cc (commit)
       via  4d53e0a75e3ccddf14f556e88302573f14aa8830 (commit)
       via  8c615af4dfaaec38dfb7f42ec951485644c2e24b (commit)
       via  63c5808f9328797ef225c0d81d60b0fa39ac7d3b (commit)
       via  a336e438e2dc45ffffcd656cfc81507f94e0cec5 (commit)
       via  88968265e24bc294b4055d7db8a1f9ffbaf73698 (commit)
      from  701a3fdbcc7d848b0554ff9bdaf8ba74a85b07b0 (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=991d04a395868caa7a33a0ddac9333641ec3295b
commit 991d04a395868caa7a33a0ddac9333641ec3295b
Merge: 701a3fd d257d68
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 28 10:37:08 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 28 10:37:08 2016 -0500

    Merge topic 'clarify-add_custom_command-TARGET-scope' into next
    
    d257d681 add_custom_command: Clarify error when TARGET is out of scope (#15681)
    4d53e0a7 Help: Clarify `add_custom_command(TARGET)` scope (#15681)
    8c615af4 Help: Clarify policy `CMP0040` documentation (#15681)
    63c5808f Help: Clarify scope of `if(TARGET)` expression
    a336e438 Help: Improve markup in `if` command documentation
    88968265 Help: Improve markup in `get_target_property` documentation


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d257d68138a00758910bbca3dd77dcfcc04e65cc
commit d257d68138a00758910bbca3dd77dcfcc04e65cc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 28 10:12:26 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:33:26 2016 -0500

    add_custom_command: Clarify error when TARGET is out of scope (#15681)
    
    The add_custom_command(TARGET) signature only works for targets defined
    in the current directory.  Clarify this in the error message when the
    target exists but was defined elsewhere.
    
    Inspired-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ba0d672..cba29eb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -791,7 +791,24 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
 
     if(issueMessage)
       {
-      e << "The target name \"" << target << "\" is unknown in this context.";
+      if (cmTarget const* t = this->FindTargetToUse(target))
+        {
+        if (t->IsImported())
+          {
+          e << "TARGET '" << target
+            << "' is IMPORTED and does not build here.";
+          }
+        else
+          {
+          e << "TARGET '" << target
+            << "' was not created in this directory.";
+          }
+        }
+      else
+        {
+        e << "No TARGET '" << target
+          << "' has been created in this directory.";
+        }
       IssueMessage(messageType, e.str());
       }
 
diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
index 3f82d8c..4a1077c 100644
--- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
+++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt
@@ -1,4 +1,4 @@
 CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\):
-  The target name "foobar" is unknown in this context.
+  No TARGET 'foobar' has been created in this directory.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt
index e791f0a..e3e3ff4 100644
--- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt
+++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt
@@ -4,7 +4,7 @@ CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_comman
   policy details.  Use the cmake_policy command to set the policy and
   suppress this warning.
 +
-  The target name "foobar" is unknown in this context.
+  No TARGET 'foobar' has been created in this directory.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 2f5c938..397c63d 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -8,3 +8,5 @@ run_cmake(NoOutputOrTarget)
 run_cmake(OutputAndTarget)
 run_cmake(SourceByproducts)
 run_cmake(SourceUsesTerminal)
+run_cmake(TargetImported)
+run_cmake(TargetNotInDir)
diff --git a/Tests/RunCMake/add_custom_command/TargetImported-result.txt b/Tests/RunCMake/add_custom_command/TargetImported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetImported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt
new file mode 100644
index 0000000..44c4ad8
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetImported-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TargetImported.cmake:2 \(add_custom_command\):
+  TARGET 'TargetImported' is IMPORTED and does not build here.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/add_custom_command/TargetImported.cmake b/Tests/RunCMake/add_custom_command/TargetImported.cmake
new file mode 100644
index 0000000..c0f2d66
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetImported.cmake
@@ -0,0 +1,2 @@
+add_library(TargetImported UNKNOWN IMPORTED)
+add_custom_command(TARGET TargetImported COMMAND ${CMAKE_COMMAND} -E echo tada)
diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt
new file mode 100644
index 0000000..91876a0
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TargetNotInDir.cmake:2 \(add_custom_command\):
+  TARGET 'TargetNotInDir' was not created in this directory.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake
new file mode 100644
index 0000000..a551026
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetNotInDir.cmake
@@ -0,0 +1,2 @@
+add_subdirectory(TargetNotInDir)
+add_custom_command(TARGET TargetNotInDir COMMAND ${CMAKE_COMMAND} -E echo tada)
diff --git a/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt
new file mode 100644
index 0000000..3d51d27
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt
@@ -0,0 +1 @@
+add_custom_target(TargetNotInDir)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d53e0a75e3ccddf14f556e88302573f14aa8830
commit 4d53e0a75e3ccddf14f556e88302573f14aa8830
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Thu Jan 28 10:52:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:13:27 2016 -0500

    Help: Clarify `add_custom_command(TARGET)` scope (#15681)

diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index ecbf9dd..8726b70 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -178,7 +178,7 @@ target is already built, the command will not execute.
 
 ::
 
-  add_custom_command(TARGET target
+  add_custom_command(TARGET <target>
                      PRE_BUILD | PRE_LINK | POST_BUILD
                      COMMAND command1 [ARGS] [args1...]
                      [COMMAND command2 [ARGS] [args2...] ...]
@@ -188,7 +188,10 @@ target is already built, the command will not execute.
                      [VERBATIM] [USES_TERMINAL])
 
 This defines a new command that will be associated with building the
-specified target.  When the command will happen is determined by which
+specified ``<target>``.  The ``<target>`` must be defined in the current
+directory; targets defined in other directories may not be specified.
+
+When the command will happen is determined by which
 of the following is specified:
 
 ``PRE_BUILD``

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c615af4dfaaec38dfb7f42ec951485644c2e24b
commit 8c615af4dfaaec38dfb7f42ec951485644c2e24b
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Thu Jan 28 10:52:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:13:18 2016 -0500

    Help: Clarify policy `CMP0040` documentation (#15681)
    
    State explicitly that the target must be defined in the current
    directory.  While at it, improve markup formatting.

diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst
index e746c03..d46baf6 100644
--- a/Help/policy/CMP0040.rst
+++ b/Help/policy/CMP0040.rst
@@ -1,18 +1,21 @@
 CMP0040
 -------
 
-The target in the TARGET signature of add_custom_command() must exist.
+The target in the ``TARGET`` signature of :command:`add_custom_command`
+must exist and must be defined in current directory.
 
 CMake 2.8.12 and lower silently ignored a custom command created with
-the TARGET signature of :command:`add_custom_command`
-if the target is unknown.
+the ``TARGET`` signature of :command:`add_custom_command`
+if the target is unknown or was defined outside the current directory.
 
-The OLD behavior for this policy is to ignore custom commands
-for unknown targets. The NEW behavior for this policy is to report an error
-if the target referenced in :command:`add_custom_command` is unknown.
+The ``OLD`` behavior for this policy is to ignore custom commands
+for unknown targets.  The ``NEW`` behavior for this policy is to report
+an error if the target referenced in :command:`add_custom_command` is
+unknown or was defined outside the current directory.
 
 This policy was introduced in CMake version 3.0.  CMake version
-|release| warns when the policy is not set and uses OLD behavior.  Use
-the cmake_policy command to set it to OLD or NEW explicitly.
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or
+``NEW`` explicitly.
 
 .. include:: DEPRECATED.txt

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=63c5808f9328797ef225c0d81d60b0fa39ac7d3b
commit 63c5808f9328797ef225c0d81d60b0fa39ac7d3b
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Thu Jan 28 10:52:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:13:17 2016 -0500

    Help: Clarify scope of `if(TARGET)` expression

diff --git a/Help/command/if.rst b/Help/command/if.rst
index 9548d0b..56e618c 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -67,9 +67,10 @@ Possible expressions are:
  True if the given name is an existing policy (of the form ``CMP<NNNN>``).
 
 ``if(TARGET target-name)``
- True if the given name is an existing logical target name such as those
- created by the :command:`add_executable`, :command:`add_library`, or
- :command:`add_custom_target` commands.
+ True if the given name is an existing logical target name created
+ by a call to the :command:`add_executable`, :command:`add_library`,
+ or :command:`add_custom_target` command that has already been invoked
+ (in any directory).
 
 ``if(TEST test-name)``
  True if the given name is an existing test name created by the

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a336e438e2dc45ffffcd656cfc81507f94e0cec5
commit a336e438e2dc45ffffcd656cfc81507f94e0cec5
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Thu Jan 28 10:52:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:12:51 2016 -0500

    Help: Improve markup in `if` command documentation

diff --git a/Help/command/if.rst b/Help/command/if.rst
index 2465bde..9548d0b 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -80,7 +80,7 @@ Possible expressions are:
  only for full paths.
 
 ``if(file1 IS_NEWER_THAN file2)``
- True if file1 is newer than file2 or if one of the two files doesn't
+ True if ``file1`` is newer than ``file2`` or if one of the two files doesn't
  exist.  Behavior is well-defined only for full paths.  If the file
  time stamps are exactly the same, an ``IS_NEWER_THAN`` comparison returns
  true, so that any dependent build operations will occur in the event

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88968265e24bc294b4055d7db8a1f9ffbaf73698
commit 88968265e24bc294b4055d7db8a1f9ffbaf73698
Author:     Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Thu Jan 28 10:52:15 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jan 28 10:12:50 2016 -0500

    Help: Improve markup in `get_target_property` documentation

diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst
index 7798252..2a72c3a 100644
--- a/Help/command/get_target_property.rst
+++ b/Help/command/get_target_property.rst
@@ -13,6 +13,6 @@ the variable ``VAR``.  If the property is not found, ``VAR`` will be set to
 Properties are usually used to control how a target is built, but some
 query the target instead.  This command can get properties for any
 target so far created.  The targets do not need to be in the current
-CMakeLists.txt file.
+``CMakeLists.txt`` file.
 
 See also the more general :command:`get_property` command.

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

Summary of changes:
 Help/command/add_custom_command.rst                 |    7 +++++--
 Help/command/get_target_property.rst                |    2 +-
 Help/command/if.rst                                 |    9 +++++----
 Help/policy/CMP0040.rst                             |   19 +++++++++++--------
 Source/cmMakefile.cxx                               |   19 ++++++++++++++++++-
 .../CMP0040/CMP0040-NEW-missing-target-stderr.txt   |    2 +-
 .../CMP0040/CMP0040-WARN-missing-target-stderr.txt  |    2 +-
 .../RunCMake/add_custom_command/RunCMakeTest.cmake  |    2 ++
 .../TargetImported-result.txt}                      |    0
 .../add_custom_command/TargetImported-stderr.txt    |    4 ++++
 .../add_custom_command/TargetImported.cmake         |    2 ++
 .../TargetNotInDir-result.txt}                      |    0
 .../add_custom_command/TargetNotInDir-stderr.txt    |    4 ++++
 .../add_custom_command/TargetNotInDir.cmake         |    2 ++
 .../TargetNotInDir/CMakeLists.txt                   |    1 +
 15 files changed, 57 insertions(+), 18 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => add_custom_command/TargetImported-result.txt} (100%)
 create mode 100644 Tests/RunCMake/add_custom_command/TargetImported-stderr.txt
 create mode 100644 Tests/RunCMake/add_custom_command/TargetImported.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => add_custom_command/TargetNotInDir-result.txt} (100%)
 create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir-stderr.txt
 create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir.cmake
 create mode 100644 Tests/RunCMake/add_custom_command/TargetNotInDir/CMakeLists.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list