[Cmake-commits] CMake branch, next, updated. v3.3.2-3327-ga6d1d71

Stephen Kelly steveire at gmail.com
Sun Sep 27 06:57:45 EDT 2015


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  a6d1d7162bb78f212918e04ec90a41df38a10903 (commit)
       via  6c58ccb9a6b961ad5d230a75182002612ff79698 (commit)
      from  124dc4a28d1f51aeff6591697fd34f97ce6b12fa (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=a6d1d7162bb78f212918e04ec90a41df38a10903
commit a6d1d7162bb78f212918e04ec90a41df38a10903
Merge: 124dc4a 6c58ccb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Sep 27 06:57:43 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Sep 27 06:57:43 2015 -0400

    Merge topic 'fix-qtautogen-with-object-library-Ninja' into next
    
    6c58ccb9 cmGlobalGenerator: Initialize generator targets in on construction (#15729)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c58ccb9a6b961ad5d230a75182002612ff79698
commit 6c58ccb9a6b961ad5d230a75182002612ff79698
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Sep 26 19:48:50 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Sep 27 12:56:55 2015 +0200

    cmGlobalGenerator: Initialize generator targets in on construction (#15729)
    
    The Ninja generator and Visual Studio generators are special-cased for the
    QtAutogen feature.  In order to reduce the number of custom targets, the Visual
    Studio generators prefer to create custom commands instead, and in order to
    create appropriate Ninja files, generated rcc files are listed as byproducts.
    
    This requires the use of the GetConfigCommonSourceFiles API of the
    cmGeneratorTarget for those generators when initializing the autogen target.
    The initializer method is called from Compute() after creation of the
    cmGeneratorTarget object are created, however the initialization of the object
    directory occurs later in the InitGeneratorTargets method.  That means that the
    resulting object locations are computed incorrectly and cached before the
    object directory is determined, so the generated buildsystem can not find the
    object files.
    
    The initialization of the object directory was split from the creation of
    cmGeneratorTarget instances in commit 0e0258c8 (cmGlobalGenerator: Split
    creation of generator object from initialization., 2015-07-25).  The motivation
    for the split was to do only what is essential to do early in cases where
    cmGeneratorTargets need to be created at configure-time.  That is required for
    the purpose of implementing policies CMP0024 and CMP0026, and for
    try_compile(LINK_LIBRARIES).  However, the split was not really necessary.
    
    Compute the object directory in the cmGeneratorTarget constructor instead.
    
    The QtAutogen unit test already tests the use of TARGET_OBJECTS with AUTOMOC,
    and that test already passes on Ninja.  The reason it already passes is that
    the QtAutogen target also uses the AUTORCC feature, and specifies several qrc
    files in its SOURCES.  Later in the Compute algorithm (after the
    InitGeneratorTargets call), the rcc files are determined add target->AddSource
    is called.  The AddSource call clears the previously mentioned cache of source
    files, causing it to be regenerated when next queried, this time taking account
    of the object directory.
    
    Extend the test suite with a new target which does not make use of AUTORCC with
    qrc files so that the test added alone would break without the fix in this
    commit.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 555c437..62598f4 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -275,6 +275,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
   this->LocalGenerator = lg;
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
 
+  this->GlobalGenerator->ComputeTargetObjectDirectory(this);
+
   CreatePropertyGeneratorExpressions(
         t->GetIncludeDirectoriesEntries(),
         t->GetIncludeDirectoriesBacktraces(),
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 540bd01..4a48b5d 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1263,8 +1263,6 @@ bool cmGlobalGenerator::Compute()
     this->LocalGenerators[i]->AddHelperCommands();
     }
 
-  this->InitGeneratorTargets();
-
 #ifdef CMAKE_BUILD_WITH_CMAKE
   for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin();
        it != autogenTargets.end(); ++it)
@@ -1558,19 +1556,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalGenerator::InitGeneratorTargets()
-{
-  for(cmGeneratorTargetsType::iterator ti =
-      this->GeneratorTargets.begin(); ti != this->GeneratorTargets.end(); ++ti)
-    {
-    if (!ti->second->Target->IsImported())
-      {
-      this->ComputeTargetObjectDirectory(ti->second);
-      }
-    }
-}
-
-//----------------------------------------------------------------------------
 void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
 {
   // Construct per-target generator information.
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index f3dd713..47c50a0 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -480,7 +480,6 @@ private:
   cmGeneratorTargetsType GeneratorTargets;
   friend class cmake;
   void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg);
-  void InitGeneratorTargets();
   void CreateGeneratorTargets(TargetTypes targetTypes);
 
   void ClearGeneratorMembers();
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index ebcfc0f..d5aca55 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -101,7 +101,14 @@ add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.c
 )
 set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h")
 
-set_target_properties(QtAutogen codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE)
+add_executable(targetObjectsTest targetObjectsTest.cpp $<TARGET_OBJECTS:privateSlot>)
+target_link_libraries(targetObjectsTest ${QT_LIBRARIES})
+
+set_target_properties(
+  QtAutogen codeeditorLib privateSlot targetObjectsTest
+  PROPERTIES
+  AUTOMOC TRUE
+)
 
 include(GenerateExportHeader)
 # The order is relevant here. B depends on A, and B headers depend on A
diff --git a/Tests/QtAutogen/targetObjectsTest.cpp b/Tests/QtAutogen/targetObjectsTest.cpp
new file mode 100644
index 0000000..766b775
--- /dev/null
+++ b/Tests/QtAutogen/targetObjectsTest.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+  return 0;
+}

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

Summary of changes:
 Source/cmGeneratorTarget.cxx                            |    2 ++
 Source/cmGlobalGenerator.cxx                            |   15 ---------------
 Source/cmGlobalGenerator.h                              |    1 -
 Tests/QtAutogen/CMakeLists.txt                          |    9 ++++++++-
 .../simple.cxx => QtAutogen/targetObjectsTest.cpp}      |    0
 5 files changed, 10 insertions(+), 17 deletions(-)
 copy Tests/{CTestTestCycle/simple.cxx => QtAutogen/targetObjectsTest.cpp} (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list