[Cmake-commits] CMake branch, next, updated. v3.0.0-rc2-1384-g5bb40a5

Stephen Kelly steveire at gmail.com
Fri Mar 21 06:15:02 EDT 2014


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  5bb40a56aa41d8227099a7b37fc43792fbce3140 (commit)
       via  734df96f5ad3d47b3c7825715f0b524292aa6ede (commit)
      from  bafcbef6235c1a375eeb8089d0a371ea9c1e2ea3 (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=5bb40a56aa41d8227099a7b37fc43792fbce3140
commit 5bb40a56aa41d8227099a7b37fc43792fbce3140
Merge: bafcbef 734df96
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Mar 21 06:15:01 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Mar 21 06:15:01 2014 -0400

    Merge topic 'fix-Qt4-moc-commands-depends' into next
    
    734df96f Qt4: Fix moc command dependencies for incremental build.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=734df96f5ad3d47b3c7825715f0b524292aa6ede
commit 734df96f5ad3d47b3c7825715f0b524292aa6ede
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 4 11:03:37 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Mar 21 11:14:41 2014 +0100

    Qt4: Fix moc command dependencies for incremental build.
    
    Since commit v2.8.12~327^2 (Qt4Macros: Allow specifying a TARGET
    in invokations of macros., 2013-02-26), a parameters file is
    populated with moc arguments at generate-time.
    
    When the compile definitions or include directories change, the
    parameters file is updated but moc is not re-run in response.
    
    Fix that by making the moc invocation depend on the parameters file.
    
    Reported-At: https://bugreports.qt-project.org/browse/QTBUG-36970

diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 8baf896..aca8996 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -141,7 +141,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target)
   set(_moc_extra_parameters_file @${_moc_parameters_file})
   add_custom_command(OUTPUT ${outfile}
                       COMMAND Qt4::moc ${_moc_extra_parameters_file}
-                      DEPENDS ${infile}
+                      DEPENDS ${infile} ${_moc_parameters_file}
                       ${_moc_working_dir}
                       VERBATIM)
 endmacro ()
diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt
index af9fc3f..7430084 100644
--- a/Tests/Qt4Targets/CMakeLists.txt
+++ b/Tests/Qt4Targets/CMakeLists.txt
@@ -36,3 +36,30 @@ add_executable(Qt4WrapMacroTest WIN32 main_wrap_test.cpp ${moc_file})
 set_property(TARGET Qt4WrapMacroTest PROPERTY AUTOMOC OFF)
 target_include_directories(Qt4WrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface")
 target_link_libraries(Qt4WrapMacroTest Qt4::QtGui)
+
+set(timeformat "%Y%j%H%M%S")
+try_compile(RESULT
+  "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild"
+  "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc"
+  IncrementalMoc
+  CMAKE_FLAGS -DADD_DEF=0 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}")
+file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_before "${timeformat}")
+if (NOT tsvar_before)
+  message(SEND_ERROR "Unable to read timestamp from moc file from first build!")
+endif()
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2) # Ensure that the timestamp will change.
+
+try_compile(RESULT
+  "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild"
+  "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc"
+  IncrementalMoc
+  CMAKE_FLAGS -DADD_DEF=1 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}")
+file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_after "${timeformat}")
+if (NOT tsvar_after)
+  message(SEND_ERROR "Unable to read timestamp from moc file from second build!")
+endif()
+
+if (NOT tsvar_after GREATER tsvar_before)
+  message(SEND_ERROR "Rebuild did not re-create moc file. Before: ${tsvar_before}. After: ${tsvar_after}")
+endif()
diff --git a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt
new file mode 100644
index 0000000..4ba0ced
--- /dev/null
+++ b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+cmake_minimum_required(VERSION 2.8.12)
+project(IncrementalMoc)
+
+find_package(Qt4 REQUIRED)
+
+qt4_generate_moc(foo.h moc_foo.cpp)
+
+add_library(testlib foo.cpp moc_foo.cpp)
+target_link_libraries(testlib Qt4::QtCore)
+if (ADD_DEF)
+  target_compile_definitions(testlib PRIVATE NEW_DEF)
+endif()
diff --git a/Tests/Qt4Targets/IncrementalMoc/foo.cpp b/Tests/Qt4Targets/IncrementalMoc/foo.cpp
new file mode 100644
index 0000000..e924f7e
--- /dev/null
+++ b/Tests/Qt4Targets/IncrementalMoc/foo.cpp
@@ -0,0 +1,8 @@
+
+#include "foo.h"
+
+Foo::Foo()
+  : QObject(0)
+{
+
+}
diff --git a/Tests/Qt4Targets/IncrementalMoc/foo.h b/Tests/Qt4Targets/IncrementalMoc/foo.h
new file mode 100644
index 0000000..38d899f
--- /dev/null
+++ b/Tests/Qt4Targets/IncrementalMoc/foo.h
@@ -0,0 +1,9 @@
+
+#include <QObject>
+
+class Foo : QObject
+{
+  Q_OBJECT
+public:
+  Foo();
+};

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list