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  102aee91e439d63a400c339e9ba30eae68ac57dc (commit)
       via  5f04e57c43b2e8c75a563fabb4e52d54f0ee8896 (commit)
      from  96e1c8fab1597b7c2f277b4bd79713f8d52738f3 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=102aee91e439d63a400c339e9ba30eae68ac57dc
commit 102aee91e439d63a400c339e9ba30eae68ac57dc
Merge: 96e1c8f 5f04e57
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Mon Mar 17 10:23:36 2014 -0400
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Mon Mar 17 10:23:36 2014 -0400

    Merge topic 'add_custom_command-DEPENDS-genex' into next
    
    5f04e57c CustomCommand: Evaluate generator expressions in DEPENDS.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f04e57c43b2e8c75a563fabb4e52d54f0ee8896
commit 5f04e57c43b2e8c75a563fabb4e52d54f0ee8896
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Fri Mar 7 17:20:10 2014 +0100
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Mon Mar 17 15:21:01 2014 +0100

    CustomCommand: Evaluate generator expressions in DEPENDS.
    
    Rely on evaluation in cmCustomCommandGenerator for the generators.
    
    When tracing target dependencies, depend on the union of dependencies
    for all configurations.

diff --git a/Help/command/add_custom_command.rst 
b/Help/command/add_custom_command.rst
index b0c5446..028ca5a 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -156,3 +156,7 @@ target is built before any target using this custom command.
 Additionally, if the target is an executable or library a file-level
 dependency is created to cause the custom command to re-run whenever
 the target is recompiled.
+
+Arguments to ``DEPENDS`` may use "generator expressions" with the syntax
+``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual for
+available expressions.
diff --git a/Help/release/dev/add_custom_command-DEPENDS-genex.rst 
b/Help/release/dev/add_custom_command-DEPENDS-genex.rst
new file mode 100644
index 0000000..1e528e6
--- /dev/null
+++ b/Help/release/dev/add_custom_command-DEPENDS-genex.rst
@@ -0,0 +1,5 @@
+add_custom_command-DEPENDS-genex
+--------------------------------
+
+* The :command:`add_custom_command` command learned to interpret
+  :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.
diff --git a/Source/cmCustomCommandGenerator.cxx 
b/Source/cmCustomCommandGenerator.cxx
index a091cff..cebd9f5 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
   cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
   CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
   OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
-  GE(new cmGeneratorExpression(cc.GetBacktrace()))
+  GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false)
 {
 }
 
@@ -93,5 +93,19 @@ std::vector<std::string> const& 
cmCustomCommandGenerator::GetOutputs() const
 //----------------------------------------------------------------------------
 std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
 {
-  return this->CC.GetDepends();
+  if (!this->DependsDone)
+    {
+    this->DependsDone = true;
+    std::vector<std::string> depends = this->CC.GetDepends();
+    for(std::vector<std::string>::const_iterator
+          i = depends.begin();
+        i != depends.end(); ++i)
+      {
+      cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
+                                              = this->GE->Parse(*i);
+      cmSystemTools::ExpandListArgument(
+                  cge->Evaluate(this->Makefile, this->Config), this->Depends);
+      }
+    }
+  return this->Depends;
 }
diff --git a/Source/cmCustomCommandGenerator.h 
b/Source/cmCustomCommandGenerator.h
index cbcdb41..0d8a0a4 100644
--- a/Source/cmCustomCommandGenerator.h
+++ b/Source/cmCustomCommandGenerator.h
@@ -28,6 +28,8 @@ class cmCustomCommandGenerator
   bool OldStyle;
   bool MakeVars;
   cmGeneratorExpression* GE;
+  mutable bool DependsDone;
+  mutable std::vector<std::string> Depends;
 public:
   cmCustomCommandGenerator(cmCustomCommand const& cc,
                            const std::string& config,
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 2a144c6..b35e859 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -19,6 +19,7 @@
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
 #include "cmComputeLinkInformation.h"
+#include "cmCustomCommandGenerator.h"
 
 #include <queue>
 
@@ -610,6 +611,9 @@ private:
   bool IsUtility(std::string const& dep);
   void CheckCustomCommand(cmCustomCommand const& cc);
   void CheckCustomCommands(const std::vector<cmCustomCommand>& commands);
+  void FollowCommandDepends(cmCustomCommand const& cc,
+                            const std::string& config,
+                            std::set<std::string>& emitted);
 };
 
 //----------------------------------------------------------------------------
@@ -826,16 +830,41 @@ cmTargetTraceDependencies
     }
 
   // Queue the custom command dependencies.
-  std::vector<std::string> const& depends = cc.GetDepends();
+  std::vector<std::string> configs;
+  std::set<std::string> emitted;
+  this->Makefile->GetConfigurations(configs);
+  if (configs.empty())
+    {
+    configs.push_back("");
+    }
+  for(std::vector<std::string>::const_iterator ci = configs.begin();
+      ci != configs.end(); ++ci)
+    {
+    this->FollowCommandDepends(cc, *ci, emitted);
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmTargetTraceDependencies::FollowCommandDepends(cmCustomCommand const& cc,
+                                              const std::string& config,
+                                              std::set<std::string>& emitted)
+{
+  cmCustomCommandGenerator ccg(cc, config, this->Makefile);
+
+  const std::vector<std::string>& depends = ccg.GetDepends();
+
   for(std::vector<std::string>::const_iterator di = depends.begin();
       di != depends.end(); ++di)
     {
     std::string const& dep = *di;
-    if(!this->IsUtility(dep))
+    if(emitted.insert(dep).second)
       {
-      // The dependency does not name a target and may be a file we
-      // know how to generate.  Queue it.
-      this->FollowName(dep);
+      if(!this->IsUtility(dep))
+        {
+        // The dependency does not name a target and may be a file we
+        // know how to generate.  Queue it.
+        this->FollowName(dep);
+        }
       }
     }
 }
diff --git a/Tests/CustomCommand/CMakeLists.txt 
b/Tests/CustomCommand/CMakeLists.txt
index bbae387..a194a5f 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -185,7 +185,7 @@ add_executable(CustomCommand
 # here to test adding the generation rule after referencing the
 # generated source in a target.
 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
-  DEPENDS generator
+  DEPENDS $<1:generator> $<0:does_not_exist>
   COMMAND generator
   ARGS ${PROJECT_BINARY_DIR}/generated.c
   )
@@ -221,8 +221,11 @@ add_subdirectory(GeneratorInExtraDir)
 
 add_executable(tcat tcat.cxx)
 
+# Test that list expansion from a generator expression works.
+set_property(TARGET tcat PROPERTY DEPSLIST tcat gen_redirect_in.c)
+
 add_custom_command(OUTPUT gen_redirect.c
-  DEPENDS tcat gen_redirect_in.c
+  DEPENDS $<TARGET_PROPERTY:tcat,DEPSLIST>
   COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c
   COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c
   VERBATIM

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

Summary of changes:
 Help/command/add_custom_command.rst                |    4 ++
 .../dev/add_custom_command-DEPENDS-genex.rst       |    5 +++
 Source/cmCustomCommandGenerator.cxx                |   18 ++++++++-
 Source/cmCustomCommandGenerator.h                  |    2 +
 Source/cmGeneratorTarget.cxx                       |   39 +++++++++++++++++---
 Tests/CustomCommand/CMakeLists.txt                 |    7 +++-
 6 files changed, 66 insertions(+), 9 deletions(-)
 create mode 100644 Help/release/dev/add_custom_command-DEPENDS-genex.rst


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to