Need help with custom moc commands.
Michaël Larouche
michael.larouche at kdemail.net
Fri Apr 28 14:46:32 CEST 2006
(Please CC to me as I am not a member of kde-buildsystem)
In Kopete (kdenetwork/kopete/protocols/jabber/libiris to be more precise), I
have some files where both header and implementation has the Q_OBJECT.
The Makefile.am used this trick:
s5b.lo: s5b.moc
CLEANFILES = s5b.moc
s5b.moc: $(srcdir)/s5b.cpp $(srcdir)/s5b.h
${MOC} $(srcdir)/s5b.h > $@
${MOC} $(srcdir)/s5b.cpp >> $@
and here my attempt to reproduce it in CMake:
# BEGIN moc special case
# Those are special cases, both header and implementation contains a Q_OBJECT
macro
# What we do is generate a moc file for both header and implementation and
with CMake FILE command, create the final .moc
qt4_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/iris/xmpp-core/securestream.h
${CMAKE_CURRENT_BINARY_DIR}/securestream_h.moc )
qt4_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/iris/xmpp-core/securestream.cpp
${CMAKE_CURRENT_BINARY_DIR}/securestream_cpp.moc )
qt4_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/iris/jabber/s5b.cpp
${CMAKE_CURRENT_BINARY_DIR}/s5b_cpp.moc )
qt4_generate_moc( ${CMAKE_CURRENT_SOURCE_DIR}/iris/jabber/s5b.h
${CMAKE_CURRENT_BINARY_DIR}/s5b_h.moc )
set(securestream_h_MOC)
set(securestream_cpp_MOC)
set(s5b_h_MOC)
set(s5b_cpp_MOC)
# Create securestream.moc
file(READ ${CMAKE_CURRENT_BINARY_DIR}/securestream_h.moc securestream_h_MOC)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/securestream.moc ${securestream_h_MOC})
file(READ ${CMAKE_CURRENT_BINARY_DIR}/securestream_cpp.moc
securestream_cpp_MOC)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/securestream.moc
${securestream_cpp_MOC})
# Create s5b.moc
file(READ ${CMAKE_CURRENT_BINARY_DIR}/s5b_h.moc s5b_h_MOC)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/s5b.moc ${s5b_h_MOC})
file(READ ${CMAKE_CURRENT_BINARY_DIR}/s5b_cpp.moc s5b_cpp_MOC)
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/s5b.moc ${s5b_cpp_MOC})
# END moc special case
The resulting MOC with CMake doesn't compile, and I need a cleaner way to do
it.
Thank you
--
Michaël Larouche (Shock The Dark Mage)
KDE developer working on Kopete, Kamefu...on dial-up :P
--------------------------------------
Blog: http://mlarouche.blogspot.com/
MSN/Email: michael.larouche at kdemail.net
IRC: irc.freenode.org/DarkShock on #kopete,#solid,#kamefu,#plasma
Jabber: darkshock at myjabber.net
More information about the Kde-buildsystem
mailing list