Hi,

attached is a small patch which sets the OBJECT_DEPENDS  property of a moced 
file to the generated moc file.
This has the effect that before the cpp file is built, moc has been run on it.
We have that in KDE's version of qt4_generate_moc() this way since 2006 and it 
works for us.
In cmake's version, it was removed January 11th 2008, the removed call to 
MACRO_ADD_FILE_DEPENDENCIES():
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=510f578f8b53858fbb541c4e7e4731de9bfbd483

Now since we are trying to get rid of our custom stuff in KDE, we hit that 
issue when trying to build parts of KDE with FindQt4.cmake from cmake.

Do you remember why this line was removed ?
What do you think about adding it again, as the attached patch does ?

Alex
--- Qt4Macros.cmake.orig	2012-06-15 21:39:23.000000000 +0200
+++ Qt4Macros.cmake	2012-06-15 21:36:00.000000000 +0200
@@ -133,6 +133,7 @@ MACRO (QT4_GENERATE_MOC infile outfile )
    ENDIF(NOT IS_ABSOLUTE "${outfile}")
    QT4_CREATE_MOC_COMMAND(${abs_infile} ${_outfile} "${moc_flags}" "")
    SET_SOURCE_FILES_PROPERTIES(${outfile} PROPERTIES SKIP_AUTOMOC TRUE)  # dont run automoc on this file
+   SET_PROPERTY(SOURCE "${abs_infile}" APPEND PROPERTY OBJECT_DEPENDS "${_outfile}" )
 ENDMACRO (QT4_GENERATE_MOC)
 
 
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to