[Cmake-commits] CMake branch, master, updated. v3.9.2-793-gfda9a94

Kitware Robot kwrobot at kitware.com
Thu Sep 14 07:25:05 EDT 2017


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  fda9a94fe6061908e1d66c111f9030baa62cccf7 (commit)
       via  06c8a37e5816f2431b469b37961588f494fefcd4 (commit)
       via  b494308dab7ca3fe94ce558ddddc71bcaf1a8e6d (commit)
       via  d0f1581719644cc9b40a3ad4425bd37369f11c7e (commit)
      from  d6b49ee6767e8b21eee08d218ca5f599ad8f978b (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=fda9a94fe6061908e1d66c111f9030baa62cccf7
commit fda9a94fe6061908e1d66c111f9030baa62cccf7
Merge: d6b49ee 06c8a37
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Sep 14 11:19:33 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Thu Sep 14 07:19:40 2017 -0400

    Merge topic 'autogen-target-depends-fix-3-9-2'
    
    06c8a37e Merge branch 'backport-autogen-target-depends' into autogen-target-depends-fix-3-9-2
    b494308d Autogen: Tests: Backport tests for _autogen target dependencies
    d0f15817 Autogen: Backport autogen target dependency as file dependency fix
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1257


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=06c8a37e5816f2431b469b37961588f494fefcd4
commit 06c8a37e5816f2431b469b37961588f494fefcd4
Merge: 420874b b494308
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 13 15:09:36 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 13 15:09:36 2017 -0400

    Merge branch 'backport-autogen-target-depends' into autogen-target-depends-fix-3-9-2
    
    Use the "ours" merge strategy because we already have equivalent
    changes on our side.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b494308dab7ca3fe94ce558ddddc71bcaf1a8e6d
commit b494308dab7ca3fe94ce558ddddc71bcaf1a8e6d
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Sep 13 18:31:50 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 13 15:07:46 2017 -0400

    Autogen: Tests: Backport tests for _autogen target dependencies

diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt
index a67dcfe..6241ef9 100644
--- a/Tests/QtAutogen/mocDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/mocDepends/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.7)
-project(mocDepends)
+cmake_minimum_required(VERSION 3.9)
+project(mocDepends CXX)
 
 if (QT_TEST_VERSION STREQUAL 4)
   find_package(Qt4 REQUIRED)
@@ -14,34 +14,138 @@ else()
 endif()
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
+set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
+set(CBD ${CMAKE_CURRENT_BINARY_DIR})
 
-# -- Test 1 using generated header
-# This tests the dependency of AUTOMOC of mocDepends1 to the generated object.hpp
-add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
-                   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/invalid.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
-                   COMMAND ${CMAKE_COMMAND} -E sleep 3
-                   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/object.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
-                   )
-
-add_executable(mocDepends1 test1.cpp
-  ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
-)
-target_link_libraries(mocDepends1 ${QT_CORE_TARGET})
-set_target_properties(mocDepends1 PROPERTIES AUTOMOC TRUE)
-set_property(TARGET mocDepends1 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
-
-# -- Test 2 using generated library
-# This tests the dependency of AUTOMOC of mocDepends2 to the
-# generated simpleLib.hpp which belongs to a linked library of mocDepends2
-add_custom_command(OUTPUT simpleLib.hpp simpleLib.cpp
-                   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/invalid.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.hpp
-                   COMMAND ${CMAKE_COMMAND} -E sleep 3
-                   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/simpleLib.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.hpp
-                   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/simpleLib.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.cpp
-                   )
-add_library(SimpleLib STATIC simpleLib.hpp simpleLib.cpp)
-
-add_executable(mocDepends2 test2.cpp )
-target_link_libraries(mocDepends2 SimpleLib ${QT_CORE_TARGET})
-set_target_properties(mocDepends2 PROPERTIES AUTOMOC TRUE)
-set_property(TARGET mocDepends2 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
+# -- Test dependency on header generated by a custom command
+#
+# The ORIGIN_autogen target must depend on the same *GENERATED* source files as
+# the ORIGIN target. This is a requirement to ensure that all files for the
+# ORIGIN target are generated before the ORIGIN_autogen target is built.
+#
+# This tests the dependency of the mocDepGenFile_autogen target of
+# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED*
+# by a custom command.
+# If mocDepGenFile_autogen gets built *before* or in *parallel* to the
+# custom command, the build will fail. That's because GenFile.hpp,
+# which is required by mocDepGenFile_autogen, is only valid after the
+# custom command has been completed.
+#
+# The sleep seconds artificially increase the build time of the custom command
+# to simulate a slow file generation process that takes longer to run than
+# the build of the mocDepGenFile_autogen target.
+add_custom_command(
+  OUTPUT ${CBD}/GenFile.hpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp
+  COMMAND ${CMAKE_COMMAND} -E sleep 3
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp)
+
+add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp)
+target_link_libraries(mocDepGenFile ${QT_CORE_TARGET})
+set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE)
+set_property(TARGET mocDepGenFile PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
+
+
+# -- Test dependency on header generating custom target
+#
+# The ORIGIN_autogen target must depend on the same user defined targets
+# as the ORIGIN target. This is a requirement to ensure that all files for the
+# ORIGIN target are generated before the ORIGIN_autogen target is built.
+#
+# This tests the dependency of the mocDepTarget_autogen target of
+# mocDepTarget to the utility target mocDepTargetUtil.
+# If mocDepTarget_autogen gets built *before* or in *parallel* to
+# mocDepTargetUtil, the build will fail. That's
+# because GenTarget.hpp, which is required by mocDepTarget_autogen,
+# is only valid after the mocDepTargetUtil build has been completed.
+#
+# The sleep seconds artificially increase the build time of mocDepTargetUtil
+# to simulate a slow utility target build that takes longer to run than
+# the build of the mocDepTarget_autogen target.
+add_custom_target(mocDepTargetUtil
+  BYPRODUCTS ${CBD}/GenTarget.hpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp
+  COMMAND ${CMAKE_COMMAND} -E sleep 3
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp)
+
+add_executable(mocDepTarget testGenTarget.cpp)
+target_link_libraries(mocDepTarget ${QT_CORE_TARGET})
+set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE)
+add_dependencies(mocDepTarget mocDepTargetUtil)
+
+
+# -- Test 3: Depend on generated linked library
+# The ORIGIN_autogen target must depend on the same linked libraries
+# as the ORIGIN target. This is a requirement to ensure that all files for the
+# ORIGIN target are generated before the ORIGIN_autogen target is built.
+#
+# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib
+# to the user generated library SimpleLib, which mocDepGenLib links to.
+# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib,
+# the build will fail. That's because simpleLib.hpp, which is required by
+# mocDepGenLib_autogen, is only valid after the SimpleLib build has been
+# completed.
+#
+# The sleep seconds artificially increase the build time of SimpleLib
+# to simulate a slow utility library build that takes longer to run than
+# the build of the mocDepGenLib_autogen target.
+add_custom_command(
+  OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp
+  COMMAND ${CMAKE_COMMAND} -E sleep 3
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp)
+add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp)
+target_link_libraries(SimpleLib ${QT_CORE_TARGET})
+
+add_executable(mocDepGenLib testGenLib.cpp)
+target_link_libraries(mocDepGenLib SimpleLib ${QT_CORE_TARGET})
+set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE)
+
+
+# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency
+#
+# This tests the dependency of the mocDepATDFile_autogen target of
+# mocDepATDTarget to the utility target mocDepATDFileUtil.
+# If mocDepATDFile_autogen gets built *before* or in *parallel* to
+# mocDepATDFileUtil, the build will fail. That's
+# because ATDFile.hpp, which is required by mocDepATDFile_autogen,
+# is only valid after the mocDepATDFileUtil build has been completed.
+#
+# The sleep seconds artificially increase the build time of
+# mocDepATDFileUtil to simulate a slow utility target build that takes
+# longer to run than the build of the mocDepATDFile_autogen target.
+add_custom_command(
+  OUTPUT ${CBD}/ATDFile.hpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp
+  COMMAND ${CMAKE_COMMAND} -E sleep 3
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp)
+
+add_executable(mocDepATDFile testATDFile.cpp)
+target_link_libraries(mocDepATDFile ${QT_CORE_TARGET})
+set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE)
+set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp)
+
+
+# -- Test AUTOGEN_TARGET_DEPENDS with target dependency
+#
+# This tests the dependency of the mocDepATDTarget_autogen target of
+# mocDepATDTarget to the utility target mocDepATDTargetUtil.
+# If mocDepATDTarget_autogen gets built *before* or in *parallel* to
+# mocDepATDTargetUtil, the build will fail. That's
+# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen,
+# is only valid after the mocDepATDTargetUtil build has been completed.
+#
+# The sleep seconds artificially increase the build time of
+# mocDepATDTargetUtil to simulate a slow utility target build that takes
+# longer to run than the build of the mocDepATDTarget_autogen target.
+add_custom_target(mocDepATDTargetUtil
+  BYPRODUCTS ${CBD}/ATDTarget.hpp
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp
+  COMMAND ${CMAKE_COMMAND} -E sleep 3
+  COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp)
+
+add_executable(mocDepATDTarget testATDTarget.cpp)
+target_link_libraries(mocDepATDTarget ${QT_CORE_TARGET})
+set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE)
+set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil)
diff --git a/Tests/QtAutogen/mocDepends/invalid.hpp.in b/Tests/QtAutogen/mocDepends/object_invalid.hpp.in
similarity index 100%
rename from Tests/QtAutogen/mocDepends/invalid.hpp.in
rename to Tests/QtAutogen/mocDepends/object_invalid.hpp.in
diff --git a/Tests/QtAutogen/mocDepends/object.hpp.in b/Tests/QtAutogen/mocDepends/object_valid.hpp.in
similarity index 100%
rename from Tests/QtAutogen/mocDepends/object.hpp.in
rename to Tests/QtAutogen/mocDepends/object_valid.hpp.in
diff --git a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in b/Tests/QtAutogen/mocDepends/simpleLib.hpp.in
index 758f1f6..b65b0cb 100644
--- a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in
+++ b/Tests/QtAutogen/mocDepends/simpleLib.hpp.in
@@ -1,8 +1,11 @@
 #ifndef SIMPLE_LIB_H
 #define SIMPLE_LIB_H
 
-class SimpleLib
+#include <QObject>
+
+class SimpleLib : public QObject
 {
+  Q_OBJECT
 public:
   SimpleLib();
   ~SimpleLib();
diff --git a/Tests/QtAutogen/mocDepends/test2.cpp b/Tests/QtAutogen/mocDepends/test2.cpp
deleted file mode 100644
index 155b19b..0000000
--- a/Tests/QtAutogen/mocDepends/test2.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-
-#include "test2.hpp"
-
-int main()
-{
-  SimpleLib obj;
-  LObject lobject;
-
-  return 0;
-}
diff --git a/Tests/QtAutogen/mocDepends/testATDFile.cpp b/Tests/QtAutogen/mocDepends/testATDFile.cpp
new file mode 100644
index 0000000..6bddfcd
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/testATDFile.cpp
@@ -0,0 +1,9 @@
+
+#include "ATDFile.hpp"
+#include "moc_ATDFile.cpp"
+
+int main()
+{
+  Object obj;
+  return 0;
+}
diff --git a/Tests/QtAutogen/mocDepends/testATDTarget.cpp b/Tests/QtAutogen/mocDepends/testATDTarget.cpp
new file mode 100644
index 0000000..831fc26
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/testATDTarget.cpp
@@ -0,0 +1,9 @@
+
+#include "ATDTarget.hpp"
+#include "moc_ATDTarget.cpp"
+
+int main()
+{
+  Object obj;
+  return 0;
+}
diff --git a/Tests/QtAutogen/mocDepends/test1.cpp b/Tests/QtAutogen/mocDepends/testGenFile.cpp
similarity index 65%
rename from Tests/QtAutogen/mocDepends/test1.cpp
rename to Tests/QtAutogen/mocDepends/testGenFile.cpp
index 92c259c..7df6e13 100644
--- a/Tests/QtAutogen/mocDepends/test1.cpp
+++ b/Tests/QtAutogen/mocDepends/testGenFile.cpp
@@ -1,9 +1,8 @@
 
-#include "object.hpp"
+#include "GenFile.hpp"
 
 int main()
 {
   Object obj;
-
   return 0;
 }
diff --git a/Tests/QtAutogen/mocDepends/testGenLib.cpp b/Tests/QtAutogen/mocDepends/testGenLib.cpp
new file mode 100644
index 0000000..c14e159
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/testGenLib.cpp
@@ -0,0 +1,12 @@
+
+#include "testGenLib.hpp"
+
+int main()
+{
+  SimpleLib libObject;
+  LObject lobject;
+  return 0;
+}
+
+// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp
+#include "moc_simpleLib.cpp"
diff --git a/Tests/QtAutogen/mocDepends/test2.hpp b/Tests/QtAutogen/mocDepends/testGenLib.hpp
similarity index 83%
rename from Tests/QtAutogen/mocDepends/test2.hpp
rename to Tests/QtAutogen/mocDepends/testGenLib.hpp
index 0125f07..408335b 100644
--- a/Tests/QtAutogen/mocDepends/test2.hpp
+++ b/Tests/QtAutogen/mocDepends/testGenLib.hpp
@@ -1,5 +1,5 @@
-#ifndef TEST2_HPP
-#define TEST2_HPP
+#ifndef TEST3_HPP
+#define TEST3_HPP
 
 #include "simpleLib.hpp"
 #include <QObject>
diff --git a/Tests/QtAutogen/mocDepends/testGenTarget.cpp b/Tests/QtAutogen/mocDepends/testGenTarget.cpp
new file mode 100644
index 0000000..911076e
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/testGenTarget.cpp
@@ -0,0 +1,9 @@
+
+#include "GenTarget.hpp"
+#include "moc_GenTarget.cpp"
+
+int main()
+{
+  Object obj;
+  return 0;
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0f1581719644cc9b40a3ad4425bd37369f11c7e
commit d0f1581719644cc9b40a3ad4425bd37369f11c7e
Author:     Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Wed Sep 13 16:08:48 2017 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 13 15:04:31 2017 -0400

    Autogen: Backport autogen target dependency as file dependency fix
    
    Target dependencies of the origin target were mistakenly forwarded to
    the _autogen target as *file* dependencies.  This patch introduces
    proper distinction between *target* and *file* dependencies of the
    _autogen target.
    
    This patch also changes when PRE_BUILD is used for AUTOGEN in the Visual
    Studio generator. Formerly PRE_BUILD was disabled when the origin target
    depended on *any* other target. Now PRE_BUILD is only disabled if a
    dependency of the _autogen target to an additional *file* is detected.
    
    Fixes: #17278, #17205

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index cecf165..3e3be54 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -719,7 +719,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
   const std::string qtMajorVersion = GetQtMajorVersion(target);
   const std::string rccCommand = RccGetExecutable(target, qtMajorVersion);
   const std::vector<std::string> suffixes = GetConfigurationSuffixes(makefile);
-  std::vector<std::string> autogenDepends;
+  std::vector<std::string> autogenDependFiles;
+  std::vector<std::string> autogenDependTargets;
   std::vector<std::string> autogenProvides;
 
   // Remove build directories on cleanup
@@ -810,18 +811,16 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 #endif
 
   // Initialize autogen target dependencies
-  if (const char* deps = target->GetProperty("AUTOGEN_TARGET_DEPENDS")) {
-    cmSystemTools::ExpandListArgument(deps, autogenDepends);
-  }
-  // Add link library targets to the autogen dependencies
-  {
-    const cmTarget::LinkLibraryVectorType& libVec =
-      target->Target->GetOriginalLinkLibraries();
-    for (cmTarget::LinkLibraryVectorType::const_iterator it = libVec.begin();
-         it != libVec.end(); ++it) {
-      const std::string& libName = it->first;
-      if (makefile->FindTargetToUse(libName) != CM_NULLPTR) {
-        autogenDepends.push_back(libName);
+  if (const char* extraDeps = target->GetProperty("AUTOGEN_TARGET_DEPENDS")) {
+    std::vector<std::string> deps;
+    cmSystemTools::ExpandListArgument(extraDeps, deps);
+    for (std::vector<std::string>::const_iterator itC = deps.begin(),
+                                                  itE = deps.end();
+         itC != itE; ++itC) {
+      if (makefile->FindTargetToUse(*itC) != CM_NULLPTR) {
+        autogenDependTargets.push_back(*itC);
+      } else {
+        autogenDependFiles.push_back(*itC);
       }
     }
   }
@@ -845,7 +844,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
             if (PropertyEnabled(sf, "GENERATED")) {
               if ((mocEnabled && !PropertyEnabled(sf, "SKIP_AUTOMOC")) ||
                   (uicEnabled && !PropertyEnabled(sf, "SKIP_AUTOUIC"))) {
-                autogenDepends.push_back(
+                autogenDependFiles.push_back(
                   cmsys::SystemTools::GetRealPath(sf->GetFullPath()));
 #if defined(_WIN32) && !defined(__CYGWIN__)
                 // Cannot use PRE_BUILD with generated files
@@ -890,7 +889,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
           if (PropertyEnabled(sf, "GENERATED")) {
             // Add generated qrc file to the dependencies
-            autogenDepends.push_back(absFile);
+            autogenDependFiles.push_back(absFile);
           } else {
             // Run cmake again when .qrc file changes
             makefile->AddCMakeDependFile(absFile);
@@ -898,7 +897,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
             // Add the qrc input files to the dependencies
             std::string error;
             if (!cmQtAutoGeneratorCommon::RccListInputs(
-                  qtMajorVersion, rccCommand, absFile, autogenDepends,
+                  qtMajorVersion, rccCommand, absFile, autogenDependFiles,
                   &error)) {
               cmSystemTools::Error(error.c_str());
             }
@@ -916,13 +915,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
   if (usePRE_BUILD) {
-    // If the autogen target depends on an other target don't use PRE_BUILD
-    for (std::vector<std::string>::iterator it = autogenDepends.begin();
-         it != autogenDepends.end(); ++it) {
-      if (makefile->FindTargetToUse(*it) != CM_NULLPTR) {
-        usePRE_BUILD = false;
-        break;
-      }
+    // We can't use pre-build if we depend on additional files
+    if (!autogenDependFiles.empty()) {
+      usePRE_BUILD = false;
     }
   }
   if (usePRE_BUILD) {
@@ -930,23 +925,63 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
     // rejection in cmMakefile::AddCustomCommandToTarget because we know
     // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case.
     std::vector<std::string> no_output;
-    cmCustomCommand cc(makefile, no_output, autogenProvides, autogenDepends,
+    std::vector<std::string> no_depends;
+    cmCustomCommand cc(makefile, no_output, autogenProvides, no_depends,
                        commandLines, autogenComment.c_str(),
                        workingDirectory.c_str());
     cc.SetEscapeOldStyle(false);
     cc.SetEscapeAllowMakeVars(true);
     target->Target->AddPreBuildCommand(cc);
+
+    // Add additional target dependencies to the origin target
+    for (std::vector<std::string>::const_iterator
+           itC = autogenDependTargets.begin(),
+           itE = autogenDependTargets.end();
+         itC != itE; ++itC) {
+      target->Target->AddUtility(*itC);
+    }
   } else
 #endif
   {
     cmTarget* autogenTarget = makefile->AddUtilityCommand(
       autogenTargetName, true, workingDirectory.c_str(),
-      /*byproducts=*/autogenProvides, autogenDepends, commandLines, false,
+      /*byproducts=*/autogenProvides, autogenDependFiles, commandLines, false,
       autogenComment.c_str());
 
     cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
     lg->AddGeneratorTarget(gt);
 
+    // Add origin link library targets to the autogen target dependencies
+    {
+      const cmTarget::LinkLibraryVectorType& libVec =
+        target->Target->GetOriginalLinkLibraries();
+      for (cmTarget::LinkLibraryVectorType::const_iterator
+             itC = libVec.begin(),
+             itE = libVec.end();
+           itC != itE; ++itC) {
+        const std::string& libName = itC->first;
+        if (makefile->FindTargetToUse(libName) != CM_NULLPTR) {
+          autogenDependTargets.push_back(libName);
+        }
+      }
+    }
+    // Add origin utility targets to the autogen target dependencies
+    {
+      const std::set<std::string>& utils = target->Target->GetUtilities();
+      for (std::set<std::string>::const_iterator itC = utils.begin(),
+                                                 itE = utils.end();
+           itC != itE; ++itC) {
+        autogenDependTargets.push_back(*itC);
+      }
+    }
+    // Add additional target dependencies to the autogen target
+    for (std::vector<std::string>::const_iterator
+           itC = autogenDependTargets.begin(),
+           itE = autogenDependTargets.end();
+         itC != itE; ++itC) {
+      autogenTarget->AddUtility(*itC);
+    }
+
     // Set target folder
     const char* autogenFolder =
       makefile->GetState()->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list