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  83e3b1497d4889f8dbb7238a270296377035e40b (commit)
       via  9df096633bf64a6b3f6db6489e422715a6aecbf9 (commit)
       via  22e483744290a27c17cca42e22ed47ef1b37007d (commit)
       via  5a6c6292898fe238f3a5105133b8904209fbedaf (commit)
       via  dc3401d5b08ea0c116fd5416c4d7eb5fe22e5835 (commit)
       via  7d756f37cc0dcd3dfff1c8524db5943af023cff8 (commit)
       via  946846aaf5f2f29c27769a5be0021d21ec2ae542 (commit)
       via  0b992b97517136ba21b93860ff4686b75bc962aa (commit)
       via  60cb75e4a196c97e55d535486e2d28630afb3f6e (commit)
       via  f59c33a763ba1483129f0e721bc2394bb7442876 (commit)
       via  d58d4daa6b2e36c6e2318e4d67271542dca79ee6 (commit)
      from  e5d15848ca6cdc52ff44edcde7689518793a5eb6 (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=83e3b1497d4889f8dbb7238a270296377035e40b
commit 83e3b1497d4889f8dbb7238a270296377035e40b
Merge: 9df0966 dc3401d
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 25 08:59:00 2018 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Apr 25 08:59:00 2018 -0400

    Merge branch 'release-3.11'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9df096633bf64a6b3f6db6489e422715a6aecbf9
commit 9df096633bf64a6b3f6db6489e422715a6aecbf9
Merge: 22e4837 7d756f3
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 25 12:58:34 2018 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Apr 25 08:58:39 2018 -0400

    Merge topic 'BLAS-no-target-in-libs'
    
    7d756f37cc FindBLAS: do not write an imported target name into 
BLAS_LIBRARIES
    946846aaf5 FindPkgConfig: do not unset unused variable
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !2006


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22e483744290a27c17cca42e22ed47ef1b37007d
commit 22e483744290a27c17cca42e22ed47ef1b37007d
Merge: 5a6c629 60cb75e
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 25 12:57:01 2018 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Apr 25 08:57:08 2018 -0400

    Merge topic 'fix-CMAKE_DISABLE_SOURCE_CHANGES-top-dir'
    
    60cb75e4a1 Fix CMAKE_DISABLE_SOURCE_CHANGES recognition of top of build tree
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !2001


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a6c6292898fe238f3a5105133b8904209fbedaf
commit 5a6c6292898fe238f3a5105133b8904209fbedaf
Merge: e5d1584 f59c33a
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Apr 25 12:56:06 2018 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Wed Apr 25 08:56:16 2018 -0400

    Merge topic 'vs-dedup-custom-commands'
    
    f59c33a763 VS: Generate a custom command only in the least dependent target
    d58d4daa6b cmVisualStudio10TargetGenerator: Use 
cmLocalVisualStudio10Generator
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !1889


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f59c33a763ba1483129f0e721bc2394bb7442876
commit f59c33a763ba1483129f0e721bc2394bb7442876
Author:     Fujii Hironori <fujii.hiron...@gmail.com>
AuthorDate: Fri Mar 23 15:44:42 2018 +0900
Commit:     Fujii Hironori <fujii.hiron...@gmail.com>
CommitDate: Mon Apr 23 13:31:28 2018 +0900

    VS: Generate a custom command only in the least dependent target
    
    If a custom command is assigned to multiple targets, generate the build
    rule only in the least-dependent `.vcxproj` file.  Otherwise MSBuild
    will run the command on the first build of a dependent target even if
    its dependencies already brought the command up to date (in order to
    populates its build log).
    
    Generate targets in least-to-most-dependent order, and assign a custom
    command to the least dependent target.
    
    Added cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst to call
    cmVisualStudio10TargetGenerator::Generate in least-dependent order.
    
    Moved SourcesVisited from cmVisualStudio10TargetGenerator to
    cmLocalVisualStudio10Generator to avoid attaching a custom command to
    multiple targets among the local generator.
    
    Fixes: #16767

diff --git a/Source/cmLocalVisualStudio10Generator.cxx 
b/Source/cmLocalVisualStudio10Generator.cxx
index 2803d4a..5b6e781 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -62,21 +62,47 @@ 
cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
 {
 }
 
+void cmLocalVisualStudio10Generator::GenerateTargetsDepthFirst(
+  cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
+{
+  if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+    return;
+  }
+  // Find this target in the list of remaining targets.
+  auto it = std::find(remaining.begin(), remaining.end(), target);
+  if (it == remaining.end()) {
+    // This target was already handled.
+    return;
+  }
+  // Remove this target from the list of remaining targets because
+  // we are handling it now.
+  *it = nullptr;
+  auto& deps = this->GlobalGenerator->GetTargetDirectDepends(target);
+  for (auto& d : deps) {
+    // FIXME: Revise CreateSingleVCProj so we do not have to drop `const` here.
+    auto dependee = const_cast<cmGeneratorTarget*>(&*d);
+    GenerateTargetsDepthFirst(dependee, remaining);
+    // Take the union of visited source files of custom commands
+    auto visited = GetSourcesVisited(dependee);
+    GetSourcesVisited(target).insert(visited.begin(), visited.end());
+  }
+  if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
+        ->TargetIsFortranOnly(target)) {
+    this->CreateSingleVCProj(target->GetName(), target);
+  } else {
+    cmVisualStudio10TargetGenerator tg(
+      target, static_cast<cmGlobalVisualStudio10Generator*>(
+                this->GetGlobalGenerator()));
+    tg.Generate();
+  }
+}
+
 void cmLocalVisualStudio10Generator::Generate()
 {
-  const std::vector<cmGeneratorTarget*>& tgts = this->GetGeneratorTargets();
-  for (cmGeneratorTarget* l : tgts) {
-    if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
-      continue;
-    }
-    if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
-          ->TargetIsFortranOnly(l)) {
-      this->CreateSingleVCProj(l->GetName(), l);
-    } else {
-      cmVisualStudio10TargetGenerator tg(
-        l, static_cast<cmGlobalVisualStudio10Generator*>(
-             this->GetGlobalGenerator()));
-      tg.Generate();
+  std::vector<cmGeneratorTarget*> remaining = this->GetGeneratorTargets();
+  for (auto& t : remaining) {
+    if (t) {
+      GenerateTargetsDepthFirst(t, remaining);
     }
   }
   this->WriteStampFiles();
diff --git a/Source/cmLocalVisualStudio10Generator.h 
b/Source/cmLocalVisualStudio10Generator.h
index bcdc307..a4150b9 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -33,10 +33,19 @@ public:
   void ReadAndStoreExternalGUID(const std::string& name,
                                 const char* path) override;
 
+  std::set<cmSourceFile const*>& GetSourcesVisited(cmGeneratorTarget* target)
+  {
+    return SourcesVisited[target];
+  };
+
 protected:
   const char* ReportErrorLabel() const override;
   bool CustomCommandUseLocal() const override { return true; }
 
 private:
+  void GenerateTargetsDepthFirst(cmGeneratorTarget* target,
+                                 std::vector<cmGeneratorTarget*>& remaining);
+
+  std::map<cmGeneratorTarget*, std::set<cmSourceFile const*>> SourcesVisited;
 };
 #endif
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index 625cb83..d27bec9 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1178,7 +1178,6 @@ void 
cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
 
 void cmVisualStudio10TargetGenerator::WriteCustomCommands()
 {
-  this->SourcesVisited.clear();
   this->CSharpCustomCommandNames.clear();
   std::vector<cmSourceFile const*> customCommands;
   this->GeneratorTarget->GetCustomCommands(customCommands, "");
@@ -1199,7 +1198,9 @@ void 
cmVisualStudio10TargetGenerator::WriteCustomCommands()
 void cmVisualStudio10TargetGenerator::WriteCustomCommand(
   cmSourceFile const* sf)
 {
-  if (this->SourcesVisited.insert(sf).second) {
+  if (this->LocalGenerator->GetSourcesVisited(this->GeneratorTarget)
+        .insert(sf)
+        .second) {
     if (std::vector<cmSourceFile*> const* depends =
           this->GeneratorTarget->GetSourceDepends(sf)) {
       for (cmSourceFile const* di : *depends) {
diff --git a/Source/cmVisualStudio10TargetGenerator.h 
b/Source/cmVisualStudio10TargetGenerator.h
index 53334bb..bbe3f7f 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -209,7 +209,6 @@ private:
   cmGlobalVisualStudio10Generator* const GlobalGenerator;
   cmGeneratedFileStream* BuildFileStream;
   cmLocalVisualStudio10Generator* const LocalGenerator;
-  std::set<cmSourceFile const*> SourcesVisited;
   std::set<std::string> CSharpCustomCommandNames;
   bool IsMissingFiles;
   std::vector<std::string> AddedFiles;
diff --git a/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake 
b/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake
new file mode 100644
index 0000000..fe1cceb
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+
+add_custom_command(OUTPUT generated.cpp
+  MAIN_DEPENDENCY a.c
+  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/generate-once.cmake 
${CMAKE_CURRENT_BINARY_DIR}/generated.cpp
+  VERBATIM)
+
+add_executable(exe1 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp)
+add_executable(exe2 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp)
+add_executable(exe3 ${CMAKE_CURRENT_BINARY_DIR}/generated.cpp)
+
+add_dependencies(exe1 exe2)
+add_dependencies(exe3 exe1)
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake 
b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index c12e5aa..0387dbb 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -14,3 +14,10 @@ run_cmake(TargetNotInDir)
 if(${RunCMake_GENERATOR} MATCHES "Visual Studio ([^89]|[89][0-9])")
   run_cmake(RemoveEmptyCommands)
 endif()
+
+run_cmake(AssigningMultipleTargets)
+set(RunCMake_TEST_BINARY_DIR 
${RunCMake_BINARY_DIR}/AssigningMultipleTargets-build)
+set(RunCMake_TEST_NO_CLEAN 1)
+run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .)
+unset(RunCMake_TEST_BINARY_DIR)
+unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/add_custom_command/a.c 
b/Tests/RunCMake/add_custom_command/a.c
new file mode 100644
index 0000000..707c1c3
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/a.c
@@ -0,0 +1,3 @@
+void a()
+{
+}
diff --git a/Tests/RunCMake/add_custom_command/generate-once.cmake 
b/Tests/RunCMake/add_custom_command/generate-once.cmake
new file mode 100644
index 0000000..2a8e843
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/generate-once.cmake
@@ -0,0 +1,8 @@
+if (${CMAKE_ARGC} LESS 4)
+  message(FATAL_ERROR "Too few arguments")
+endif()
+set(output "${CMAKE_ARGV3}")
+if(EXISTS ${output})
+  message(FATAL_ERROR "${output} already exists")
+endif()
+file(WRITE ${output} "int main() { return 0; }\n")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d58d4daa6b2e36c6e2318e4d67271542dca79ee6
commit d58d4daa6b2e36c6e2318e4d67271542dca79ee6
Author:     Fujii Hironori <fujii.hiron...@gmail.com>
AuthorDate: Fri Mar 23 15:44:40 2018 +0900
Commit:     Fujii Hironori <fujii.hiron...@gmail.com>
CommitDate: Tue Apr 17 11:03:17 2018 +0900

    cmVisualStudio10TargetGenerator: Use cmLocalVisualStudio10Generator
    
    Change the type of a member variable `LocalGenerator` from
    `cmLocalVisualStudio7Generator` to `cmLocalVisualStudio10Generator`.

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index cabe89f..625cb83 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -8,7 +8,7 @@
 #include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalVisualStudio10Generator.h"
-#include "cmLocalVisualStudio7Generator.h"
+#include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
@@ -204,7 +204,8 @@ 
cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
   , Name(target->GetName())
   , GUID(gg->GetGUID(this->Name))
   , GlobalGenerator(gg)
-  , LocalGenerator((cmLocalVisualStudio7Generator*)target->GetLocalGenerator())
+  , LocalGenerator(
+      (cmLocalVisualStudio10Generator*)target->GetLocalGenerator())
 {
   this->Makefile->GetConfigurations(this->Configurations);
   this->NsightTegra = gg->IsNsightTegra();
diff --git a/Source/cmVisualStudio10TargetGenerator.h 
b/Source/cmVisualStudio10TargetGenerator.h
index 3c53d1b..53334bb 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -17,7 +17,7 @@ class cmCustomCommand;
 class cmGeneratedFileStream;
 class cmGeneratorTarget;
 class cmGlobalVisualStudio10Generator;
-class cmLocalVisualStudio7Generator;
+class cmLocalVisualStudio10Generator;
 class cmMakefile;
 class cmSourceFile;
 class cmSourceGroup;
@@ -208,7 +208,7 @@ private:
   bool TargetCompileAsWinRT;
   cmGlobalVisualStudio10Generator* const GlobalGenerator;
   cmGeneratedFileStream* BuildFileStream;
-  cmLocalVisualStudio7Generator* const LocalGenerator;
+  cmLocalVisualStudio10Generator* const LocalGenerator;
   std::set<cmSourceFile const*> SourcesVisited;
   std::set<std::string> CSharpCustomCommandNames;
   bool IsMissingFiles;

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

Summary of changes:
 Modules/FindBLAS.cmake                             |    6 ++-
 Modules/FindPkgConfig.cmake                        |    1 -
 Source/cmLocalVisualStudio10Generator.cxx          |   52 +++++++++++++++-----
 Source/cmLocalVisualStudio10Generator.h            |    9 ++++
 Source/cmMakefile.cxx                              |    3 +-
 Source/cmVisualStudio10TargetGenerator.cxx         |   10 ++--
 Source/cmVisualStudio10TargetGenerator.h           |    5 +-
 .../AssigningMultipleTargets.cmake                 |   13 +++++
 .../RunCMake/add_custom_command/RunCMakeTest.cmake |    7 +++
 .../{add_dependencies => add_custom_command}/a.c   |    0
 .../add_custom_command/generate-once.cmake         |    8 +++
 11 files changed, 91 insertions(+), 23 deletions(-)
 create mode 100644 
Tests/RunCMake/add_custom_command/AssigningMultipleTargets.cmake
 copy Tests/RunCMake/{add_dependencies => add_custom_command}/a.c (100%)
 create mode 100644 Tests/RunCMake/add_custom_command/generate-once.cmake


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

Reply via email to