[Cmake-commits] CMake branch, next, updated. v2.8.12-4825-g16d8630

Stephen Kelly steveire at gmail.com
Mon Nov 4 05:45:44 EST 2013


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  16d8630a82203f01ddd17fc2f5150b265752bb19 (commit)
       via  c0ffa8eccd347e381e59b2db4db5e4f39b577aba (commit)
       via  879b906d2c96b960c3037706057f2bc4f387db0a (commit)
       via  8d01a791f5ac1078b38ec1e8522e36bee185b456 (commit)
       via  944da5d25819b696c61330790b33d8ed56badf61 (commit)
       via  f47f1ec66a50521fcc825bb738c424f48e9f6a2e (commit)
      from  3c7262d7f4cfbfabd7665f87ab8480d13389c5cc (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=16d8630a82203f01ddd17fc2f5150b265752bb19
commit 16d8630a82203f01ddd17fc2f5150b265752bb19
Merge: 3c7262d c0ffa8e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 05:45:40 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 4 05:45:40 2013 -0500

    Merge topic 'fix-autogen-definitions' into next
    
    c0ffa8e Extract FinalizeTargetCompileDefinitions from cmGeneratorTarget.
    879b906 cmQtAutogen: Gather tool arguments after creating generator targets.
    8d01a79 cmAutogen: Rename method to InitializeAutogenTarget
    944da5d Move autogen target creation to InitializeMocSourceFile.
    f47f1ec Extract some helper methods for autogen targets.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0ffa8eccd347e381e59b2db4db5e4f39b577aba
commit c0ffa8eccd347e381e59b2db4db5e4f39b577aba
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 10:51:37 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 4 11:30:51 2013 +0100

    Extract FinalizeTargetCompileDefinitions from cmGeneratorTarget.
    
    Call the method early in the generate step.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 7d99abe..ead3508 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1095,6 +1095,8 @@ void cmGlobalGenerator::Generate()
     return;
     }
 
+  this->FinalizeTargetCompileDefinitions();
+
   // Iterate through all targets and set up automoc for those which have
   // the AUTOMOC, AUTOUIC or AUTORCC property set
   AutogensType autogens;
@@ -1300,13 +1302,11 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::CreateGeneratorTargets()
+void cmGlobalGenerator::FinalizeTargetCompileDefinitions()
 {
   // Construct per-target generator information.
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
-    cmGeneratorTargetsType generatorTargets;
-
     cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
 
     const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
@@ -1321,7 +1321,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
       {
       cmTarget* t = &ti->second;
 
-      {
       for (std::vector<cmValueWithOrigin>::const_iterator it
                                       = noconfig_compile_definitions.begin();
           it != noconfig_compile_definitions.end(); ++it)
@@ -1338,7 +1337,24 @@ void cmGlobalGenerator::CreateGeneratorTargets()
                           mf->GetProperty(defPropName.c_str()));
         }
       }
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalGenerator::CreateGeneratorTargets()
+{
+  // Construct per-target generator information.
+  for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
+    {
+    cmGeneratorTargetsType generatorTargets;
+
+    cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
 
+    cmTargets& targets = mf->GetTargets();
+    for(cmTargets::iterator ti = targets.begin();
+        ti != targets.end(); ++ti)
+      {
+      cmTarget* t = &ti->second;
       cmGeneratorTarget* gt = new cmGeneratorTarget(t);
       this->GeneratorTargets[t] = gt;
       generatorTargets[t] = gt;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index d08ae2a..2e20a4d 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -414,6 +414,7 @@ private:
   // Per-target generator information.
   cmGeneratorTargetsType GeneratorTargets;
   void CreateGeneratorTargets();
+  void FinalizeTargetCompileDefinitions();
   void ComputeGeneratorTargetObjects();
   void ClearGeneratorTargets();
   virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=879b906d2c96b960c3037706057f2bc4f387db0a
commit 879b906d2c96b960c3037706057f2bc4f387db0a
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 10:34:54 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 4 11:30:50 2013 +0100

    cmQtAutogen: Gather tool arguments after creating generator targets.
    
    One of the side-effects in cmGlobalGenerator::CreateGeneratorTargets
    is that compile definitions from the makefile are appended to the
    target. Compile definitions are read from the target directly for
    generating the buildsystem, and generating the Autogen info too
    early caused incomplete compile definitions to be used (#14535).
    
    The compile definitions related code will be moved out of
    CreateGeneratorTargets in a followup commit. However this change
    also has the independent benefit that it causes the
    GetLinkInterfaceDependentStringProperty method to be called in
    SetupAutoGenerateTarget, after the creation of generator targets. In
    CMake 4.0, the GetLinkInterfaceDependentStringProperty will move to
    the cmGeneratorTarget class, and this is a necessary prerequisite to
    that.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index eac54c3..7d99abe 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1097,7 +1097,8 @@ void cmGlobalGenerator::Generate()
 
   // Iterate through all targets and set up automoc for those which have
   // the AUTOMOC, AUTOUIC or AUTORCC property set
-  this->CreateQtAutoGeneratorsTargets();
+  AutogensType autogens;
+  this->CreateQtAutoGeneratorsTargets(autogens);
 
   // For each existing cmLocalGenerator
   unsigned int i;
@@ -1131,6 +1132,12 @@ void cmGlobalGenerator::Generate()
   // Create per-target generator information.
   this->CreateGeneratorTargets();
 
+  for (AutogensType::iterator it = autogens.begin(); it != autogens.end();
+       ++it)
+    {
+    it->first.SetupAutoGenerateTarget(it->second);
+    }
+
   // Trace the dependencies, after that no custom commands should be added
   // because their dependencies might not be handled correctly
   for (i = 0; i < this->LocalGenerators.size(); ++i)
@@ -1256,11 +1263,9 @@ bool cmGlobalGenerator::CheckTargets()
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
+void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
 {
 #ifdef CMAKE_BUILD_WITH_CMAKE
-  typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > Autogens;
-  Autogens autogens;
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
     cmTargets& targets =
@@ -1289,11 +1294,8 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
         }
       }
     }
-  for (Autogens::iterator it = autogens.begin(); it != autogens.end();
-       ++it)
-    {
-    it->first.SetupAutoGenerateTarget(it->second);
-    }
+#else
+  (void)autogens;
 #endif
 }
 
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4d6e10f..d08ae2a 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -32,6 +32,7 @@ class cmTarget;
 class cmInstallTargetGenerator;
 class cmInstallFilesGenerator;
 class cmExportBuildFileGenerator;
+class cmQtAutoGenerators;
 
 /** \class cmGlobalGenerator
  * \brief Responable for overseeing the generation process for the entire tree
@@ -323,7 +324,8 @@ protected:
   virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS();
 
   bool CheckTargets();
-  void CreateQtAutoGeneratorsTargets();
+  typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget*> > AutogensType;
+  void CreateQtAutoGeneratorsTargets(AutogensType& autogens);
 
 
   // Fill the ProjectMap, this must be called after LocalGenerators

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d01a791f5ac1078b38ec1e8522e36bee185b456
commit 8d01a791f5ac1078b38ec1e8522e36bee185b456
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 10:32:27 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 4 11:30:50 2013 +0100

    cmAutogen: Rename method to InitializeAutogenTarget
    
    This reflects better what it is doing.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4fe5033..eac54c3 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1281,7 +1281,7 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
             && !target.IsImported())
           {
           cmQtAutoGenerators autogen;
-          if(autogen.InitializeMocSourceFile(&target))
+          if(autogen.InitializeAutogenTarget(&target))
             {
             autogens.push_back(std::make_pair(autogen, &target));
             }
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index e07f7b4..36cb368 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -156,7 +156,7 @@ static std::string getAutogenTargetDir(cmTarget *target)
   return targetDir;
 }
 
-bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
+bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
 {
   cmMakefile* makefile = target->GetMakefile();
   // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 696abc8..116f174 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -23,7 +23,7 @@ public:
   cmQtAutoGenerators();
   bool Run(const char* targetDirectory, const char *config);
 
-  bool InitializeMocSourceFile(cmTarget* target);
+  bool InitializeAutogenTarget(cmTarget* target);
   void SetupAutoGenerateTarget(cmTarget* target);
 
 private:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=944da5d25819b696c61330790b33d8ed56badf61
commit 944da5d25819b696c61330790b33d8ed56badf61
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 10:29:21 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 4 11:30:46 2013 +0100

    Move autogen target creation to InitializeMocSourceFile.
    
    The SetupAutoGenerateTarget method will soon be invoked at a later
    time in a followup commit. We need to ensure that we create the
    utility autogen target early.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index dcd0300..e07f7b4 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -185,75 +185,9 @@ bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
 
     target->AddSourceFile(mocCppSource);
     }
-  return true;
-}
-
-static void GetCompileDefinitionsAndDirectories(cmTarget *target,
-                                                const char * config,
-                                                std::string &incs,
-                                                std::string &defs)
-{
-  cmMakefile* makefile = target->GetMakefile();
-  cmLocalGenerator* localGen = makefile->GetLocalGenerator();
-  std::vector<std::string> includeDirs;
-  cmGeneratorTarget gtgt(target);
-  // Get the include dirs for this target, without stripping the implicit
-  // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
-  localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX", config, false);
-  const char* sep = "";
-  incs = "";
-  for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
-      incDirIt != includeDirs.end();
-      ++incDirIt)
-    {
-    incs += sep;
-    sep = ";";
-    incs += *incDirIt;
-    }
-
-  std::set<std::string> defines;
-  localGen->AddCompileDefinitions(defines, target, config);
-
-  sep = "";
-  for(std::set<std::string>::const_iterator defIt = defines.begin();
-      defIt != defines.end();
-      ++defIt)
-    {
-    defs += sep;
-    sep = ";";
-    defs += *defIt;
-    }
-}
-
-void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
-{
-  cmMakefile* makefile = target->GetMakefile();
-  const char* targetName = target->GetName();
-
-  // forget the variables added here afterwards again:
-  cmMakefile::ScopePushPop varScope(makefile);
-  static_cast<void>(varScope);
-
-  const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
-  if (!qtVersion)
-    {
-    qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
-    }
-  if (const char *targetQtVersion =
-      target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
-    {
-    qtVersion = targetQtVersion;
-    }
-  if (qtVersion)
-    {
-    makefile->AddDefinition("_target_qt_version", qtVersion);
-    }
   // create a custom target for running generators at buildtime:
   std::string autogenTargetName = getAutogenTargetName(target);
 
-  makefile->AddDefinition("_moc_target_name",
-          cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
-
   std::string targetDir = getAutogenTargetDir(target);
 
   cmCustomCommandLine currentLine;
@@ -296,7 +230,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
     tools += " and " + toolNames[0];
     }
   std::string autogenComment = "Automatic " + tools + " for target ";
-  autogenComment += targetName;
+  autogenComment += target->GetName();
 
 #if defined(_WIN32) && !defined(__CYGWIN__)
   bool usePRE_BUILD = false;
@@ -353,6 +287,77 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
     target->AddUtility(autogenTargetName.c_str());
     }
 
+  return true;
+}
+
+static void GetCompileDefinitionsAndDirectories(cmTarget *target,
+                                                const char * config,
+                                                std::string &incs,
+                                                std::string &defs)
+{
+  cmMakefile* makefile = target->GetMakefile();
+  cmLocalGenerator* localGen = makefile->GetLocalGenerator();
+  std::vector<std::string> includeDirs;
+  cmGeneratorTarget gtgt(target);
+  // Get the include dirs for this target, without stripping the implicit
+  // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
+  localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX", config, false);
+  const char* sep = "";
+  incs = "";
+  for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
+      incDirIt != includeDirs.end();
+      ++incDirIt)
+    {
+    incs += sep;
+    sep = ";";
+    incs += *incDirIt;
+    }
+
+  std::set<std::string> defines;
+  localGen->AddCompileDefinitions(defines, target, config);
+
+  sep = "";
+  for(std::set<std::string>::const_iterator defIt = defines.begin();
+      defIt != defines.end();
+      ++defIt)
+    {
+    defs += sep;
+    sep = ";";
+    defs += *defIt;
+    }
+}
+
+void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
+{
+  cmMakefile* makefile = target->GetMakefile();
+
+  // forget the variables added here afterwards again:
+  cmMakefile::ScopePushPop varScope(makefile);
+  static_cast<void>(varScope);
+
+  // create a custom target for running generators at buildtime:
+  std::string autogenTargetName = getAutogenTargetName(target);
+
+  makefile->AddDefinition("_moc_target_name",
+          cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
+
+  std::string targetDir = getAutogenTargetDir(target);
+
+  const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
+  if (!qtVersion)
+    {
+    qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
+    }
+  if (const char *targetQtVersion =
+      target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
+    {
+    qtVersion = targetQtVersion;
+    }
+  if (qtVersion)
+    {
+    makefile->AddDefinition("_target_qt_version", qtVersion);
+    }
+
   std::map<std::string, std::string> configIncludes;
   std::map<std::string, std::string> configDefines;
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f47f1ec66a50521fcc825bb738c424f48e9f6a2e
commit f47f1ec66a50521fcc825bb738c424f48e9f6a2e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 4 10:25:08 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 4 10:26:58 2013 +0100

    Extract some helper methods for autogen targets.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 5f7a26f..dcd0300 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -138,6 +138,24 @@ cmQtAutoGenerators::cmQtAutoGenerators()
     }
 }
 
+static std::string getAutogenTargetName(cmTarget *target)
+{
+  std::string autogenTargetName = target->GetName();
+  autogenTargetName += "_automoc";
+  return autogenTargetName;
+}
+
+static std::string getAutogenTargetDir(cmTarget *target)
+{
+  cmMakefile* makefile = target->GetMakefile();
+  std::string targetDir = makefile->GetCurrentOutputDirectory();
+  targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
+  targetDir += "/";
+  targetDir += getAutogenTargetName(target);
+  targetDir += ".dir/";
+  return targetDir;
+}
+
 bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
 {
   cmMakefile* makefile = target->GetMakefile();
@@ -154,8 +172,7 @@ bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
 
   if (target->GetPropertyAsBool("AUTOMOC"))
     {
-    std::string automocTargetName = target->GetName();
-    automocTargetName += "_automoc";
+    std::string automocTargetName = getAutogenTargetName(target);
     std::string mocCppFile = makefile->GetCurrentOutputDirectory();
     mocCppFile += "/";
     mocCppFile += automocTargetName;
@@ -232,17 +249,12 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
     makefile->AddDefinition("_target_qt_version", qtVersion);
     }
   // create a custom target for running generators at buildtime:
-  std::string autogenTargetName = targetName;
-  autogenTargetName += "_automoc";
+  std::string autogenTargetName = getAutogenTargetName(target);
 
   makefile->AddDefinition("_moc_target_name",
           cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
 
-  std::string targetDir = makefile->GetCurrentOutputDirectory();
-  targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
-  targetDir += "/";
-  targetDir += autogenTargetName;
-  targetDir += ".dir/";
+  std::string targetDir = getAutogenTargetDir(target);
 
   cmCustomCommandLine currentLine;
   currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));

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

Summary of changes:
 Source/cmGlobalGenerator.cxx  |   46 ++++++++----
 Source/cmGlobalGenerator.h    |    5 +-
 Source/cmQtAutoGenerators.cxx |  171 ++++++++++++++++++++++------------------
 Source/cmQtAutoGenerators.h   |    2 +-
 4 files changed, 131 insertions(+), 93 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list