[Cmake-commits] CMake branch, next, updated. v2.8.10.2-2254-g7487a8f

Stephen Kelly steveire at gmail.com
Wed Feb 20 18:07:14 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  7487a8f9b09bd683c34da4db1c969b6cff45e9e9 (commit)
       via  12183914ad7552494a35237736dd7c26c36bdc64 (commit)
      from  f6180d8aee61e7f170caadcce23eda6623665eba (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=7487a8f9b09bd683c34da4db1c969b6cff45e9e9
commit 7487a8f9b09bd683c34da4db1c969b6cff45e9e9
Merge: f6180d8 1218391
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 20 18:07:12 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 20 18:07:12 2013 -0500

    Merge topic 'fix-automoc-linker-language' into next
    
    1218391 Add automoc source file to target early to set the linker language.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12183914ad7552494a35237736dd7c26c36bdc64
commit 12183914ad7552494a35237736dd7c26c36bdc64
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Feb 20 17:06:45 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Feb 20 17:06:45 2013 +0100

    Add automoc source file to target early to set the linker language.
    
    Previously, GetIncludeDirectories was called before calling
    target->AddSourceFile(mocCppSource). Since commit a1c4905f (Use the
    link information as a source of compile definitions and
    includes., 2013-02-12), the include directories are determined by
    the link information.
    
    Valid link information requires that the linker language can be
    determined, which depends on the source files languages and the
    dependent targets languages. In the case of the no_link_languages
    target in the unit test, there are no dependencies and the additional
    source file no_link_languages_automoc.cpp is added to the target
    at generate-time. That file can be used to determine the linker
    language, but it must be added to the target before calling
    GetIncludeDirectories.

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ba29589..f2defbb 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1067,6 +1067,8 @@ bool cmGlobalGenerator::CheckTargets()
 void cmGlobalGenerator::CreateAutomocTargets()
 {
 #ifdef CMAKE_BUILD_WITH_CMAKE
+  typedef std::vector<std::pair<cmQtAutomoc, cmTarget*> > Automocs;
+  Automocs automocs;
   for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
     {
     cmTargets& targets =
@@ -1084,11 +1086,17 @@ void cmGlobalGenerator::CreateAutomocTargets()
         if(target.GetPropertyAsBool("AUTOMOC") && !target.IsImported())
           {
           cmQtAutomoc automoc;
-          automoc.SetupAutomocTarget(&target);
+          automoc.InitializeMocSourceFile(&target);
+          automocs.push_back(std::make_pair(automoc, &target));
           }
         }
       }
     }
+  for (Automocs::iterator it = automocs.begin(); it != automocs.end();
+       ++it)
+    {
+    it->first.SetupAutomocTarget(it->second);
+    }
 #endif
 }
 
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 4818f1b..10ce641 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -119,6 +119,22 @@ cmQtAutomoc::cmQtAutomoc()
     }
 }
 
+void cmQtAutomoc::InitializeMocSourceFile(cmTarget* target)
+{
+  std::string automocTargetName = target->GetName();
+  cmMakefile *makefile = target->GetMakefile();
+  automocTargetName += "_automoc";
+  std::string mocCppFile = makefile->GetCurrentOutputDirectory();
+  mocCppFile += "/";
+  mocCppFile += automocTargetName;
+  mocCppFile += ".cpp";
+  cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
+                                                         true);
+  makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+                           mocCppFile.c_str(), false);
+
+  target->AddSourceFile(mocCppSource);
+}
 
 void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
 {
@@ -268,17 +284,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
   outputFile += "/AutomocInfo.cmake";
   makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(),
                           false, true, false);
-
-  std::string mocCppFile =  makefile->GetCurrentOutputDirectory();
-  mocCppFile += "/";
-  mocCppFile += automocTargetName;
-  mocCppFile += ".cpp";
-  cmSourceFile* mocCppSource = makefile->GetOrCreateSource(mocCppFile.c_str(),
-                                                         true);
-  target->AddSourceFile(mocCppSource);
-
-  makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
-                           mocCppFile.c_str(), false);
 }
 
 
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index 69da80e..962e254 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -23,6 +23,7 @@ public:
   cmQtAutomoc();
   bool Run(const char* targetDirectory);
 
+  void InitializeMocSourceFile(cmTarget* target);
   void SetupAutomocTarget(cmTarget* target);
 
 private:
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 530818e..ebfbb03 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -38,3 +38,9 @@ generate_export_header(libC)
 target_link_libraries(libC LINK_PUBLIC libB)
 
 target_link_libraries(foo codeeditorLib ${QT_LIBRARIES} libC)
+
+add_library(empty STATIC empty.cpp)
+set_target_properties(empty PROPERTIES AUTOMOC TRUE)
+target_link_libraries(empty no_link_language)
+add_library(no_link_language STATIC empty.h)
+set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)

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

Summary of changes:
 Source/cmGlobalGenerator.cxx   |   10 +++++++++-
 Source/cmQtAutomoc.cxx         |   27 ++++++++++++++++-----------
 Source/cmQtAutomoc.h           |    1 +
 Tests/QtAutomoc/CMakeLists.txt |    6 ++++++
 4 files changed, 32 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list